Fix sonar critical 07/12807/1
authorPamela Dragosh <pdragosh@research.att.com>
Fri, 15 Sep 2017 21:05:44 +0000 (17:05 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Fri, 15 Sep 2017 21:25:47 +0000 (17:25 -0400)
Last transient/serializable issues.
Throw a dedicated exception for DateUtil class
Unused imports
Make the enclosing method "static" or remove this set.

Issue-ID: POLICY-115
Change-Id: I366f85922c4d4d290b320e0b88678c805de59872
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java
controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java
controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java
controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java

index aac90f7..a31007f 100644 (file)
@@ -437,7 +437,7 @@ public class SOActorServiceProvider implements Actor {
        /**
         * @param vnfItemVnfId the vnfItemVnfId to set
         */
-       private void setVnfItemVnfId(String vnfItemVnfId) {
+       private static void setVnfItemVnfId(String vnfItemVnfId) {
                SOActorServiceProvider.vnfItemVnfId = vnfItemVnfId;
        }
 
@@ -535,7 +535,7 @@ public class SOActorServiceProvider implements Actor {
        /**
         * @param serviceItemServiceInstanceId the serviceItemServiceInstanceId to set
         */
-       private void setServiceItemServiceInstanceId(
+       private static void setServiceItemServiceInstanceId(
                        String serviceItemServiceInstanceId) {
                SOActorServiceProvider.serviceItemServiceInstanceId = serviceItemServiceInstanceId;
        }
index afb847e..9ee6f23 100644 (file)
@@ -59,9 +59,19 @@ import com.att.research.xacml.std.pip.engines.StdConfigurableEngine;
 
 
 public class PIPEngineGetHistory extends StdConfigurableEngine{
+       
        private interface DateUtil{
+               public class DateUtilException extends Exception {
+                       private static final long serialVersionUID = 2612662650481443076L;
+
+                       public DateUtilException(String message) {
+                               super(message);
+                       }
+                       
+               }
+               
         public long getMs();
-        public DateUtil init(String sqlValUnit) throws Exception;
+        public DateUtil init(String sqlValUnit) throws DateUtilException;
     }
 
        private static final Logger logger = LoggerFactory.getLogger(PIPEngineGetHistory.class);
@@ -338,10 +348,10 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
                        private double multiplier = 0;
 
                        @Override
-                       public DateUtil init(String sqlValUnit) throws Exception{
+                       public DateUtil init(String sqlValUnit) throws DateUtilException{
                                String[] split = sqlValUnit.split(" ");
                                if(split.length != 2){
-                                       throw new Exception("Invalid Value Unit pair for SQL");
+                                       throw new DateUtilException("Invalid Value Unit pair for SQL");
                                }
 
                                ms = Long.parseLong(split[0]);
index 12e80d5..2f8acf6 100644 (file)
 
 package org.onap.policy.aai;
 
+import java.io.Serializable;
 import java.util.LinkedList;
 import java.util.List;
 
 import com.google.gson.annotations.SerializedName;
 
-public class RelatedToProperty {
+public class RelatedToProperty implements Serializable {
   
+       /**
+        * 
+        */
+       private static final long serialVersionUID = 2088088164920423658L;
        @SerializedName("related-to-property")
        public List<RelatedToPropertyItem> relatedTo = new LinkedList<RelatedToPropertyItem>();
 
index e5bc055..2ad3731 100644 (file)
 package org.onap.policy.aai;
 
 import java.util.List;
+import java.io.Serializable;
 import java.util.LinkedList;
 
 import com.google.gson.annotations.SerializedName;
 
-public class RelationshipData {
+public class RelationshipData implements Serializable {
 
+       /**
+        * 
+        */
+       private static final long serialVersionUID = 6809180843309562121L;
        @SerializedName("relationship-data")
        public List<RelationshipDataItem> relationshipData = new LinkedList<>();
        
index dc53e26..f5d42c9 100644 (file)
@@ -32,10 +32,9 @@ import java.util.UUID;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.onap.policy.aai.AAIGETResponse;
 import org.onap.policy.aai.AAIGETVnfResponse;
-import org.onap.policy.aai.AAINQInstanceFilters;
 import org.onap.policy.aai.AAIManager;
+import org.onap.policy.aai.AAINQInstanceFilters;
 import org.onap.policy.aai.AAINQNamedQuery;
 import org.onap.policy.aai.AAINQQueryParameters;
 import org.onap.policy.aai.AAINQRequest;