From 71b3a6b68a1a27839fde863b46c74587131be313 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Mon, 29 Apr 2019 13:07:09 -0400 Subject: Fix sonar bug and upgrade parent * Fix simple sonar bug for logging errors * Private constructors to hide implicit. * Not enough arguments for debug statement * Upgrade to policy/parent released version Issue-ID: POLICY-1700 Change-Id: Id8040c2aa0abdbe4946db60f97cb279974817447 Signed-off-by: Pamela Dragosh --- .../policy/drools/server/restful/RestControlLoopManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'controlloop/common/feature-controlloop-management/src/main') diff --git a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java index 0b4005a17..57ef17a33 100644 --- a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java +++ b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java @@ -45,6 +45,8 @@ import org.onap.policy.controlloop.processor.ControlLoopProcessor; import org.onap.policy.drools.apps.controlloop.feature.management.ControlLoopManagementFeature; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.system.PolicyController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Telemetry Extensions for Control Loops in the PDP-D. @@ -55,6 +57,7 @@ import org.onap.policy.drools.system.PolicyController; @Consumes(MediaType.APPLICATION_JSON) @Api public class RestControlLoopManager { + private static final Logger logger = LoggerFactory.getLogger(RestControlLoopManager.class); /** * GET control loops. @@ -79,6 +82,7 @@ public class RestControlLoopManager { return Response.status(Response.Status.OK).entity(controlLoopNames).build(); } catch (IllegalArgumentException e) { + logger.error("{}", e); return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build(); } } @@ -108,6 +112,7 @@ public class RestControlLoopManager { return Response.status(Response.Status.OK).entity(controlLoopParams).build(); } catch (IllegalArgumentException e) { + logger.error("{}", e); return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build(); } } @@ -145,8 +150,10 @@ public class RestControlLoopManager { return Response.status(Status.OK) .entity(URLDecoder.decode(controlLoopParams.getControlLoopYaml(), "UTF-8")).build(); } catch (IllegalArgumentException e) { + logger.error("{}", e); return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build(); } catch (UnsupportedEncodingException e) { + logger.error("{}", e); return Response.status(Status.INTERNAL_SERVER_ERROR).entity("Unreadable Policy").build(); } } @@ -207,8 +214,10 @@ public class RestControlLoopManager { return Response.status(Status.OK).entity(controlLoop).build(); } catch (IllegalArgumentException i) { + logger.error("{}", i); return Response.status(Response.Status.NOT_FOUND).entity(i).build(); } catch (ControlLoopException | UnsupportedEncodingException e) { + logger.error("{}", e); return Response.status(Status.NOT_ACCEPTABLE).entity(e).build(); } } -- cgit 1.2.3-korg