aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java38
1 files changed, 19 insertions, 19 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
index c5deee4ebd..1a37f90bfb 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
@@ -407,25 +407,25 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
if (requirementMapping != null && !requirementMapping.isEmpty()) {
String mappedNodeTemplateId = requirementMapping.get(0);
Optional<NodeTemplate> mappedNodeTemplate = getNodeTemplateById(substituteServiceTemplate, mappedNodeTemplateId);
- mappedNodeTemplate.orElseThrow(
- () -> new CoreException(new ToscaInvalidEntryNotFoundErrorBuilder("Node Template", mappedNodeTemplateId).build()));
- Map.Entry<String, NodeTemplate> mappedNodeTemplateEntry = new Map.Entry<String, NodeTemplate>() {
- @Override
- public String getKey() {
- return mappedNodeTemplateId;
- }
-
- @Override
- public NodeTemplate getValue() {
- return mappedNodeTemplate.get();
- }
-
- @Override
- public NodeTemplate setValue(NodeTemplate value) {
- return null;
- }
- };
- return Optional.of(mappedNodeTemplateEntry);
+ if (mappedNodeTemplate.isPresent()) {
+ final NodeTemplate nodeTemplate = mappedNodeTemplate.get();
+ return Optional.of(new HashMap.Entry<>() {
+ @Override
+ public String getKey() {
+ return mappedNodeTemplateId;
+ }
+ @Override
+ public NodeTemplate getValue() {
+ return nodeTemplate;
+ }
+ @Override
+ public NodeTemplate setValue(final NodeTemplate nodeTemplate) {
+ return null;
+ }
+ });
+ } else {
+ throw new CoreException(new ToscaInvalidEntryNotFoundErrorBuilder("Node Template", mappedNodeTemplateId).build());
+ }
}
}
}