From 15dfe1e9a127bc73f671b9601d8b8c8e25c2d65f Mon Sep 17 00:00:00 2001 From: talio Date: Tue, 21 Nov 2017 09:53:17 +0200 Subject: 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 --- .../sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl') 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 serviceTemplateMap = new HashMap<>(); Collection 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()); } } -- cgit 1.2.3-korg