aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorr.bogacki <r.bogacki@samsung.com>2019-06-04 12:30:05 +0200
committerr.bogacki <r.bogacki@samsung.com>2019-06-04 12:32:20 +0200
commit203d4b0db84bc0164eab04651de302f2d3868012 (patch)
treed46fd1320d8cd293a5f2e5aee05dc2d5577e3ed4
parentf6335efd71dee46bd9577bb746877d64f0ecccc0 (diff)
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
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java10
1 files changed, 6 insertions, 4 deletions
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 b29e856782..5ae57e4133 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 @@ package org.onap.so.asdc.installer;
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 @@ public class VfResourceStructure extends ResourceStructure {
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 @@ public class VfResourceStructure extends ResourceStructure {
}
protected void addArtifactByType(IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult,
- VfModuleArtifact vfModuleArtifact) throws UnsupportedEncodingException {
+ VfModuleArtifact vfModuleArtifact) {
switch (artifactinfo.getArtifactType()) {
case ASDCConfiguration.HEAT:
@@ -133,7 +134,7 @@ public class VfResourceStructure extends ResourceStructure {
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 @@ public class VfResourceStructure extends ResourceStructure {
return vfModulesStructureList;
}
+ @Override
public Map<String, VfModuleArtifact> getArtifactsMapByUUID() {
return artifactsMapByUUID;
}
@@ -204,6 +206,6 @@ public class VfResourceStructure extends ResourceStructure {
} catch (IOException e) {
logger.debug("IOException : ", e);
}
- return null;
+ return new ArrayList<>();
}
}