Improvements in VfResourceStructure
Improvements in VfResourceStructure according to the Sonar analyses.
-Removed unnecessary imports.
-Removed unnecessary exceptions.
-Improvements for possible NPE issues.
Issue-ID: SO-1983
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Change-Id: I014c5de19eca853cf1263b541e2c34b6e6db9b1d
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
index b29e856..5ae57e4 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
@@ -25,7 +25,7 @@
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
+import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -81,6 +81,7 @@
super(notificationdata, resourceinstance);
this.resourceType = ResourceType.VF_RESOURCE;
vfModulesStructureList = new LinkedList<>();
+ vfModulesMetadataList = new ArrayList<>();
}
public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo,
@@ -106,7 +107,7 @@
}
protected void addArtifactByType(IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult,
- VfModuleArtifact vfModuleArtifact) throws UnsupportedEncodingException {
+ VfModuleArtifact vfModuleArtifact) {
switch (artifactinfo.getArtifactType()) {
case ASDCConfiguration.HEAT:
@@ -133,7 +134,7 @@
public void createVfModuleStructures() throws ArtifactInstallerException {
// for vender tosca VNF there is no VFModule in VF
- if (vfModulesMetadataList == null) {
+ if (vfModulesMetadataList.isEmpty()) {
logger.info(Strings.repeat("{} ", 4), MessageEnum.ASDC_GENERAL_INFO.toString(),
"There is no VF mudules in the VF.", "ASDC", "createVfModuleStructures");
return;
@@ -148,6 +149,7 @@
return vfModulesStructureList;
}
+ @Override
public Map<String, VfModuleArtifact> getArtifactsMapByUUID() {
return artifactsMapByUUID;
}
@@ -204,6 +206,6 @@
} catch (IOException e) {
logger.debug("IOException : ", e);
}
- return null;
+ return new ArrayList<>();
}
}