From 203d4b0db84bc0164eab04651de302f2d3868012 Mon Sep 17 00:00:00 2001 From: "r.bogacki" Date: Tue, 4 Jun 2019 12:30:05 +0200 Subject: 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 Change-Id: I014c5de19eca853cf1263b541e2c34b6e6db9b1d --- .../java/org/onap/so/asdc/installer/VfResourceStructure.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'asdc-controller') 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 getArtifactsMapByUUID() { return artifactsMapByUUID; } @@ -204,6 +206,6 @@ public class VfResourceStructure extends ResourceStructure { } catch (IOException e) { logger.debug("IOException : ", e); } - return null; + return new ArrayList<>(); } } -- cgit 1.2.3-korg