Merge "Sonar fixes"
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java
index 6831a65..92ed61d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java
@@ -50,11 +50,8 @@
 public class SdncInputParametersProvider extends AbstractInputParametersProvider<GenericVnf> {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(SdncInputParametersProvider.class);
-
     private static final String VNF_PARAMETERS_PATH = "$..vnf-parameters";
-
     private final SDNCClient sdncClient;
-
     private final ObjectMapper mapper;
 
     @Autowired
@@ -68,34 +65,12 @@
         final String vnfName = genericVnf.getVnfName();
         final String vnfType = getVnfType(genericVnf);
         final String url = getPreloadVnfsUrl(vnfName, vnfType);
+        final InputParameter inputParameter = parseInputParametersUsingUrl(url);
 
-        try {
-            LOGGER.debug("Will query sdnc for input parameters using url: {}", url);
-            final String jsonResponse = sdncClient.get(url);
-            final String json = JsonPathUtil.getInstance().locateResult(jsonResponse, VNF_PARAMETERS_PATH).orElse(null);
-
-            try {
-
-                if (json != null) {
-                    final List<VnfParameter> vnfParametersArray =
-                            mapper.readValue(json, new TypeReference<List<VnfParameter>>() {});
-                    final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParametersArray);
-                    final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap);
-                    final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap);
-                    final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks);
-                    LOGGER.info("InputParameter found in sdnc response : {}", inputParameter);
-                    return inputParameter;
-                }
-
-            } catch (final IOException exception) {
-                LOGGER.error("Unable to parse vnf parameters : {}", json, exception);
-            }
-        } catch (final Exception exception) {
-            LOGGER.error("Unable to retrieve/parse input parameters using URL: {} ", url, exception);
-        }
+        if (inputParameter != null)
+            return inputParameter;
         LOGGER.warn("No input parameters found ...");
         return NullInputParameter.NULL_INSTANCE;
-
     }
 
     private List<ExternalVirtualLink> getExtVirtualLinks(final Map<String, String> vnfParametersMap) {
@@ -109,19 +84,18 @@
 
     private Map<String, String> getAdditionalParameters(final Map<String, String> vnfParametersMap) {
         final String additionalParamsString = vnfParametersMap.get(ADDITIONAL_PARAMS);
+
         if (additionalParamsString != null && !additionalParamsString.isEmpty()) {
             return parseAdditionalParameters(additionalParamsString);
         }
         return Collections.emptyMap();
     }
 
-
     private Map<String, String> getVnfParameterMap(final List<VnfParameter> array) {
         if (array != null) {
             return array.stream().filter(vnfParam -> vnfParam.getName() != null && vnfParam.getValue() != null)
                     .collect(Collectors.toMap(VnfParameter::getName, VnfParameter::getValue));
         }
-
         return Collections.emptyMap();
     }
 
@@ -131,10 +105,43 @@
 
     private String getVnfType(final GenericVnf genericVnf) {
         final ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
-        if (modelInfoGenericVnf != null && modelInfoGenericVnf.getModelName() != null) {
+        if (modelInfoGenericVnf != null) {
             return modelInfoGenericVnf.getModelName();
         }
         return genericVnf.getVnfType();
     }
 
+    private InputParameter parseInputParametersUsingUrl(String url) {
+        try {
+            LOGGER.debug("Will query sdnc for input parameters using url: {}", url);
+            final String jsonResponse = sdncClient.get(url);
+            final String json = JsonPathUtil.getInstance().locateResult(jsonResponse, VNF_PARAMETERS_PATH).orElse(null);
+            final InputParameter inputParameter = parseVnfParameters(json);
+
+            if (inputParameter != null)
+                return inputParameter;
+        } catch (final Exception exception) {
+            LOGGER.error("Unable to retrieve/parse input parameters using URL: {} ", url, exception);
+        }
+        return null;
+    }
+
+    private InputParameter parseVnfParameters(String json) {
+        try {
+            if (json != null) {
+                final List<VnfParameter> vnfParametersArray =
+                        mapper.readValue(json, new TypeReference<List<VnfParameter>>() {});
+                final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParametersArray);
+                final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap);
+                final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap);
+                final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks);
+                LOGGER.info("InputParameter found in sdnc response : {}", inputParameter);
+                return inputParameter;
+            }
+
+        } catch (final IOException exception) {
+            LOGGER.error("Unable to parse vnf parameters : {}", json, exception);
+        }
+        return null;
+    }
 }
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java
index ac939d0..bdd738b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java
@@ -40,12 +40,12 @@
             final InputParameter inputParameter = new InputParameter();
             final Object additionalParams = userParams.get(ADDITIONAL_PARAMS);
 
-            if (additionalParams != null && additionalParams instanceof String) {
+            if (additionalParams instanceof String) {
                 inputParameter.setAdditionalParams(parseAdditionalParameters(additionalParams.toString()));
             }
 
             final Object extVirtualLinks = userParams.get(EXT_VIRTUAL_LINKS);
-            if (extVirtualLinks != null && extVirtualLinks instanceof String) {
+            if (extVirtualLinks instanceof String) {
                 inputParameter.setExtVirtualLinks(parseExternalVirtualLinks(extVirtualLinks.toString()));
             }
             LOGGER.info("InputParameter found in userParams : {}", inputParameter);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
index 0d45dad..2491c99 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
@@ -35,30 +35,18 @@
     @JsonProperty("vnf-parameter-value")
     private String value;
 
-    /**
-     * @return the name
-     */
     public String getName() {
         return name;
     }
 
-    /**
-     * @param name the name to set
-     */
     public void setName(final String name) {
         this.name = name;
     }
 
-    /**
-     * @return the value
-     */
     public String getValue() {
         return value;
     }
 
-    /**
-     * @param value the value to set
-     */
     public void setValue(final String value) {
         this.value = value;
     }
@@ -66,10 +54,9 @@
     @Override
     public int hashCode() {
         final int prime = 31;
-        int result = 1;
-        result = prime * result + ((name == null) ? 0 : name.hashCode());
-        result = prime * result + ((value == null) ? 0 : value.hashCode());
-        return Objects.hash(name, value);
+        int nameResult = prime + ((name == null) ? 0 : name.hashCode());
+        int valueResult = prime + ((value == null) ? 0 : value.hashCode());
+        return Objects.hash(nameResult, valueResult);
     }
 
     @Override
@@ -78,7 +65,6 @@
             VnfParameter other = (VnfParameter) obj;
             return Objects.equals(name, other.name) && Objects.equals(value, other.value);
         }
-
         return false;
     }
 
@@ -86,5 +72,4 @@
     public String toString() {
         return "VnfParameter [name=" + name + ", value=" + value + "]";
     }
-
 }
diff --git a/so-sdn-clients/pom.xml b/so-sdn-clients/pom.xml
index c9b417b..66780c7 100644
--- a/so-sdn-clients/pom.xml
+++ b/so-sdn-clients/pom.xml
@@ -53,7 +53,7 @@
           <configuration>
             <lifecycleMappingMetadata>
               <pluginExecutions>
-                  <pluginExecution>
+                <pluginExecution>
                   <pluginExecutionFilter>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-dependency-plugin</artifactId>
@@ -112,7 +112,7 @@
           <groupId>javax.ws.rs</groupId>
           <artifactId>jsr311-api</artifactId>
         </exclusion>
-		<exclusion>
+        <exclusion>
           <groupId>io.swagger</groupId>
           <artifactId>swagger-annotations</artifactId>
         </exclusion>
@@ -152,7 +152,7 @@
       <groupId>org.mariadb.jdbc</groupId>
       <artifactId>mariadb-java-client</artifactId>
     </dependency>
-     <dependency>
+    <dependency>
       <groupId>org.glassfish.jersey.core</groupId>
       <artifactId>jersey-common</artifactId>
     </dependency>