diff options
author | lding7 <liang.ding@intel.com> | 2018-03-19 16:22:01 +0800 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2018-03-28 12:12:41 +0000 |
commit | ff31b1eea7a5aec585fbbdf5004d2c1d93f4437e (patch) | |
tree | 4094fb9c4018a669241098be5c40575da2cf8869 | |
parent | 65029c3dfc0f876284489009a01252e1088eac03 (diff) |
fix sonar complaints NullPointerException in SDC
bugs from https://sonar.onap.org/project/issues?id=
org.openecomp.sdc%3Asdc-main%3A1.2.0-SNAPSHOT&open=
AWIFjPUXRGy6eclHC_Q6&resolved=false&types=BUG
and https://sonar.onap.org/project/issues?id=
org.openecomp.sdc%3Asdc-main%3A1.2.0-SNAPSHOT&open=
AWIFjPUXRGy6eclHC_Q5&resolved=false&types=BUG
Change-Id: I88225e4da197bed62d588026564bd688a9627c8a
Issue-ID: SDC-1146
Signed-off-by: lding7 <liang.ding@intel.com>
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java index a00bd8e967..faa53862ef 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java @@ -212,16 +212,14 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa @Override public Set<CompositionEntityValidationData> getAllErrorsByVsp(String vspId) { - CompositionEntityValidationData matchVsp = null; Set<CompositionEntityValidationData> entitiesWithErrors = new HashSet<>(); for (CompositionEntityValidationData root : roots) { if (root.getEntityId().equals(vspId)) { - matchVsp = root; + getEntityListWithErrors(root, entitiesWithErrors); break; } } - getEntityListWithErrors(matchVsp, entitiesWithErrors); if (CollectionUtils.isNotEmpty(entitiesWithErrors)) { updateValidationCompositionEntityName(entitiesWithErrors); return entitiesWithErrors; @@ -449,6 +447,9 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa case vsp: CompositionEntityData vspEntity = getCompositionEntityDataById(entity); + if (Objects.isNull(vspEntity)) { + return null; + } VspQuestionnaireEntity vspQuestionnaireEntity = (VspQuestionnaireEntity) vspEntity.entity; VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspQuestionnaireEntity.getId(), |