From f1d0e936a6a99d81f2d3e74825a717e7440285ea Mon Sep 17 00:00:00 2001 From: mojahidi Date: Thu, 12 Jul 2018 17:56:07 +0530 Subject: Handle logs in ExternalArtifactEnricher removed try catch from both classes ToscaEnricher and ExternalArtifactEnricher methods and Handled exception in EnrichmentManagerImpl Change-Id: I7562185272e2a62d71a1c66208b711c3e30fcb3d Issue-ID: SDC-836 Signed-off-by: mojahidi --- .../impl/external/artifact/ExternalArtifactEnricher.java | 12 ++---------- .../java/org/openecomp/sdc/enrichment/inter/Enricher.java | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java') diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java index 150e9629a8..49ba6148c0 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java @@ -25,8 +25,6 @@ import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.enrichment.inter.Enricher; import org.openecomp.sdc.enrichment.inter.ExternalArtifactEnricherInterface; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import java.lang.reflect.Constructor; @@ -40,7 +38,6 @@ public class ExternalArtifactEnricher extends Enricher { + ".json"; private static Collection implementingClasses = getExternalArtifactEnrichedImplClassesList(); - private static Logger logger = LoggerFactory.getLogger(ExternalArtifactEnricher.class); private static Collection getExternalArtifactEnrichedImplClassesList() { @SuppressWarnings("unchecked") @@ -51,18 +48,13 @@ public class ExternalArtifactEnricher extends Enricher { } @Override - public Map> enrich() { + public Map> enrich() throws Exception{ Map> errors = new HashMap<>(); - try { for (String implementingClassName : implementingClasses) { ExternalArtifactEnricherInterface externalArtifactEnricherInstance = getExternalArtifactEnricherInstance(implementingClassName); - externalArtifactEnricherInstance.enrich(this.data, (ToscaServiceModel) this.model); + errors.putAll(externalArtifactEnricherInstance.enrich(this.data, (ToscaServiceModel) this.model)); } - } catch (Exception e) { - logger.debug("",e); - logger.error(e.getMessage()); - } return errors; } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java index ed606f8746..8e66887c1e 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java @@ -42,5 +42,5 @@ public abstract class Enricher { this.model = model; } - public abstract Map> enrich(); + public abstract Map> enrich() throws Exception; } -- cgit 1.2.3-korg