summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main/java')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java5
1 files changed, 2 insertions, 3 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 bb557f6076..053253a993 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
@@ -182,7 +182,6 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
}
String convertServiceTemplateImport(ToscaExtensionYamlUtil toscaExtensionYamlUtil, byte[] fileContent) {
-
Map serviceTemplateMap = toscaExtensionYamlUtil.yamlToObject(new String(fileContent), Map.class);
convertToscaImports(serviceTemplateMap, toscaExtensionYamlUtil);
return toscaExtensionYamlUtil.objectToYaml(serviceTemplateMap);
@@ -191,8 +190,8 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
private void convertToscaImports(Map serviceTemplateMap, ToscaExtensionYamlUtil toscaExtensionYamlUtil) {
List<Map<String, Import>> convertedImport = new ArrayList<>();
Object importObj = serviceTemplateMap.get(IMPORTS);
- if (!(importObj instanceof List)) {
- throw new SdcRuntimeException("Illegal Statement");
+ if (Objects.nonNull(importObj) && !(importObj instanceof List)) {
+ throw new SdcRuntimeException(new IllegalStateException("Invalid TOSCA import section"));
}
List<Object> imports = (List) importObj;
if (CollectionUtils.isEmpty(imports)) {