summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2018-04-23 18:47:18 +0300
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-04-24 05:28:13 +0000
commit41f385fc32fcb50d211c4cf4685fc4da2ff894c9 (patch)
treebfa5be08b19bcb9fdf1c127e5f488d36a1e7142b /openecomp-be/lib
parent5668d53e5261594b53f50dc750a7e9841cb27bf1 (diff)
Fix 2 healing bugs
1. Prevent NullPointerException in healing manager. 2. When submitting healed vsp version - sync vlm only if vsp includes vlm version. Change-Id: I3b7088b15f51a5ffe12e277567677a83fc141763 Issue-ID: SDC-1234 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/lib')
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java
index 942bc43fd8..71d4ca5386 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.healing.impl;
+
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.json.JsonUtil;
@@ -39,6 +40,7 @@ import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
import java.util.Collection;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -229,12 +231,14 @@ public class HealingManagerImpl implements HealingManager {
private List<Healer> getHealersToRun(Collection<String> healersClassNames, String itemId,
Version version, List<String> failureMessages) {
- return healersClassNames.stream()
- .map(healerClassName -> getHealerInstance(healerClassName, failureMessages))
- .filter(Optional::isPresent)
- .map(Optional::get)
- .filter(healer -> healer.isHealingNeeded(itemId, version))
- .collect(Collectors.toList());
+ return healersClassNames == null
+ ? Collections.EMPTY_LIST
+ : healersClassNames.stream()
+ .map(healerClassName -> getHealerInstance(healerClassName, failureMessages))
+ .filter(Optional::isPresent)
+ .map(Optional::get)
+ .filter(healer -> healer.isHealingNeeded(itemId, version))
+ .collect(Collectors.toList());
}
private Optional<Healer> getHealerInstance(String healerClassName, List<String> failureMessages) {
@@ -251,7 +255,7 @@ public class HealingManagerImpl implements HealingManager {
Map healingConfig = FileUtils
.readViaInputStream(HEALERS_BY_ENTITY_TYPE_FILE,
stream -> JsonUtil.json2Object(stream, Map.class));
- return (Map<String, Collection<String>>) healingConfig.get(itemType.name());
+ return (Map<String, Collection<String>>) healingConfig.getOrDefault(itemType.name(), Collections.EMPTY_MAP);
}
private String getUser() {