Fix sonar bug and upgrade parent 58/86558/1
authorPamela Dragosh <pdragosh@research.att.com>
Mon, 29 Apr 2019 17:07:09 +0000 (13:07 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Mon, 29 Apr 2019 17:07:14 +0000 (13:07 -0400)
* 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 <pdragosh@research.att.com>
controlloop/common/coordination/src/main/java/org/onap/policy/coordination/Util.java
controlloop/common/database/src/main/java/org/onap/policy/database/operationshistory/GetOperationOutcomePip.java
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/utils/ControlLoopUtils.java
controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java
pom.xml

index d766840..12b361f 100644 (file)
@@ -42,6 +42,10 @@ public final class Util {
 
     private static final Logger logger = LoggerFactory.getLogger(Util.class);
 
+    private Util() {
+        super();
+    }
+
     /**
      * Load YAML coordination directive.
      *
index 01b0709..20c8f02 100644 (file)
@@ -124,7 +124,7 @@ public class GetOperationOutcomePip extends StdOnapPip {
     }
 
     private String doDatabaseQuery(String clname, String target) {
-        logger.info("Querying operations history for {} {} {} {} {}",
+        logger.info("Querying operations history for {} {}",
                     clname, target);
         //
         // Do the query
index 8b7876c..8684a91 100644 (file)
@@ -36,6 +36,10 @@ public class ControlLoopUtils {
     public static final Logger logger = LoggerFactory.getLogger(ControlLoopUtils.class);
     public static final String TOSCA_POLICY_PROPERTY_CONTENT = "content";
 
+    private ControlLoopUtils() {
+        super();
+    }
+
     /**
      * Get a Control Loop Parameters object from a Tosca Policy.
      */
index 0b4005a..57ef17a 100644 (file)
@@ -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();
         }
     }
diff --git a/pom.xml b/pom.xml
index 99974e2..6bb680c 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
     <parent>
         <groupId>org.onap.policy.parent</groupId>
         <artifactId>integration</artifactId>
-        <version>2.1.0-SNAPSHOT</version>
+        <version>2.1.0</version>
         <relativePath />
     </parent>