aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main
diff options
context:
space:
mode:
authortalio <tali.orenbach@amdocs.com>2017-11-21 09:53:17 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2017-11-21 09:22:17 +0000
commit15dfe1e9a127bc73f671b9601d8b8c8e25c2d65f (patch)
tree656c6b72380aecd1c4cb235eb53b47108031f306 /openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main
parent7bd878afa02d188e687a6958ae999807c2106392 (diff)
invalid yaml exception
throw an invalid yaml exception if one of the retrieved service templates is corrupted, while submitting a VSP Issue - Id : SDC-693 Change-Id: Icf37cf1aa847385ef118a1395b1afdfe99e9d79d Signed-off-by: talio <tali.orenbach@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main')
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java
index 88a1c756c9..b5e3627e61 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java
@@ -11,10 +11,12 @@ import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.ItemVersion;
import org.apache.commons.io.IOUtils;
import org.openecomp.core.model.dao.ServiceModelDao;
+import org.openecomp.core.model.errors.RetrieveServiceTemplateFromDbErrorBuilder;
import org.openecomp.core.model.types.ServiceElement;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
@@ -84,17 +86,12 @@ public class ServiceModelDaoZusammenImpl
context, elementContext, serviceModelElementId, StructureElement.Templates.name());
if (templatesElementInfo.isPresent()) {
-
- //Map<String, ServiceTemplate> serviceTemplateMap = new HashMap<>();
Collection<Element> elements = zusammenAdaptor.listElementData(context, elementContext,
templatesElementInfo.get().getId());
return elements.stream().collect(Collectors.toMap(
element -> element.getInfo().getName(),
this::elementToServiceTemplate));
- /*elements.stream().forEach(element ->serviceTemplateMap.put(element.getInfo().getName(),
- elementToServiceTemplate(element)));
- return serviceTemplateMap;*/
}
return null;
}
@@ -186,8 +183,9 @@ public class ServiceModelDaoZusammenImpl
return new ToscaExtensionYamlUtil().
yamlToObject(yamlContent, ServiceTemplate.class);
}catch (Exception e){
- logger.debug("",e);
- return null;
+ throw new CoreException(
+ new RetrieveServiceTemplateFromDbErrorBuilder(
+ element.getInfo().getName(), e.getMessage()).build());
}
}