Fix Null Pointer Issue 75/78175/2
authorshrek2000 <orenkle@amdocs.com>
Sun, 10 Feb 2019 11:28:36 +0000 (13:28 +0200)
committershrek2000 <orenkle@amdocs.com>
Sun, 10 Feb 2019 12:30:22 +0000 (14:30 +0200)
Add dependent child service to service
Issue-ID: SDC-1987

Change-Id: I99418251ffc45f025fe9cd4505159a20ea115e86
Signed-off-by: shrek2000 <orenkle@amdocs.com>
catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/DeclaredInputsResolver.java
catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyInstanceMergeDataBuilder.java

index 6f60776..28e1b93 100644 (file)
@@ -66,6 +66,7 @@ public class DeclaredInputsResolver {
 
     private List<InputDefinition> prepareInputsForRedeclaration(Map<String, InputDefinition> oldInputsById, RedeclareInputData redeclareInputData) {
         List<InputDefinition> inputsForRedeclaration = redeclareInputData.declaredInputIds.stream()
+                                            .filter(oldInputsById::containsKey)
                                             .map(oldInputsById::get)
                                             .map(InputDefinition::new)
                                             .collect(Collectors.toList());
index 7f9bf1c..840cf77 100644 (file)
@@ -1,5 +1,6 @@
 package org.openecomp.sdc.be.components.merge.property;
 
+import java.util.Objects;
 import org.openecomp.sdc.be.dao.utils.MapUtil;
 import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
@@ -66,7 +67,7 @@ class PropertyInstanceMergeDataBuilder {
     private static List<String> getOldDeclaredInputsByUser(List<GetInputValueDataDefinition> getInputValues, Map<String, InputDefinition> oldInputsByName) {
         return getInputValues.stream().map(GetInputValueDataDefinition::getInputName)
                                       .map(oldInputsByName::get)
-                                      .filter(oldInput -> oldInput.getInstanceUniqueId() != null)
+                                      .filter(oldInput ->  Objects.nonNull(oldInput) && oldInput.getInstanceUniqueId() != null)
                                       .map(PropertyDataDefinition::getName)
                                       .collect(Collectors.toList());
     }