Fixed string literal comparision major issue 45/15345/1
authorshashikanth <shashikanth.vh@huawei.com>
Tue, 26 Sep 2017 05:38:08 +0000 (11:08 +0530)
committershashikanth <shashikanth.vh@huawei.com>
Tue, 26 Sep 2017 05:38:09 +0000 (11:08 +0530)
https://sonar.onap.org/component_issues?id=org.openecomp.so%3Aso#fileUuids=AV3BnsdG5bp_wwmIVCEu|resolved=false|severities=MAJOR

Issue-Id:SO-118
Change-Id: I9ce4b3cb4c5acc5d19183dc278e4907aae221443
Signed-off-by: shashikanth.vh <shashikanth.vh@huawei.com>
asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java

index 73f37e3..bd20eb0 100644 (file)
@@ -220,7 +220,7 @@ public class VfResourceInstaller implements IVfResourceInstaller {
                        String resourceType = vfResourceStructure.getResourceInstance().getResourceType();
                        String resourceCategory = vfResourceStructure.getResourceInstance().getCategory();
 
-                       if(resourceType.equals("VF")){
+                       if("VF".equals(resourceType)){
 
                                if(resourceCategory.equalsIgnoreCase("Allotted Resource")){
                                        VfResourceInstaller.createAllottedResourceCustomization(vfResourceStructure);
@@ -231,7 +231,7 @@ public class VfResourceInstaller implements IVfResourceInstaller {
                                }
                        }
 
-                       if(resourceType.equals("VL")){
+                       if("VL".equals(resourceType)){
                                VfResourceInstaller.createNetworkResourceCustomization(vfResourceStructure);
                                catalogDB.saveNetworkResourceCustomization(vfResourceStructure.getCatalogNetworkResourceCustomization());
                        }
@@ -243,12 +243,12 @@ public class VfResourceInstaller implements IVfResourceInstaller {
                        catalogDB.saveService(vfResourceStructure.getCatalogService());
 
                        // Now that the service has been added we can populate the Service_to_AllottedResources table
-                       if(resourceType.equals("VF") && resourceCategory.equalsIgnoreCase("Allotted Resource")){
+                       if("VF".equals(resourceType) && "Allotted Resource".equalsIgnoreCase(resourceCategory)){
                                catalogDB.saveServiceToAllottedResources(vfResourceStructure.getCatalogServiceToAllottedResources());
                        }
 
                        // Now that the service has been added we can populate the Service_to_Network table
-                       if(resourceType.equals("VL")){
+                       if("VL".equals(resourceType)){
                                catalogDB.saveServiceToNetworks(vfResourceStructure.getCatalogServiceToNetworks());
                        }
 
@@ -667,7 +667,7 @@ public class VfResourceInstaller implements IVfResourceInstaller {
 //             heatTemplate.setAsdcResourceName(vfResourceStructure.getResourceInstance().getResourceName());
                heatTemplate.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
 
-               List<String> typeList = new ArrayList<String>();
+               List<String> typeList = new ArrayList<>();
                typeList.add(ASDCConfiguration.HEAT_NESTED);
                typeList.add(ASDCConfiguration.HEAT_ARTIFACT);
 
@@ -707,7 +707,7 @@ public class VfResourceInstaller implements IVfResourceInstaller {
                // TODO Set the label
 //             heatEnvironment.setAsdcLabel("Label");
 
-               List<String> typeList = new ArrayList<String>();
+               List<String> typeList = new ArrayList<>();
                typeList.add(ASDCConfiguration.HEAT);
                typeList.add(ASDCConfiguration.HEAT_VOL);