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>
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 a00bd8e..faa5386 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 @@
 
   @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 @@
 
       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(),