From 396cb378ab8940b1adb8ba1adc656d0b4ad66f99 Mon Sep 17 00:00:00 2001 From: Divesh Mirchandani Date: Thu, 14 Sep 2017 19:14:21 +0530 Subject: Fixed SONAR issues Fixed blocker, critical, major & minor SONAR issues. Issue-ID: SDC-343 Change-Id: I72e5a3a7fa7d7407a92f98f77e4334827f70f926 Signed-off-by: dd4616 --- .../org/openecomp/sdc/validation/base/ResourceBaseValidator.java | 1 + .../org/openecomp/sdc/validation/util/ValidationTestUtil.java | 8 +++++++- .../java/org/openecomp/sdc/validation/util/ValidationUtil.java | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk') diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java index 1a5b373833..f5d01d90e8 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java @@ -53,6 +53,7 @@ public class ResourceBaseValidator implements Validator { try { manifestContent = ValidationUtil.checkValidationPreCondition(globalContext); } catch (Exception exception) { + logger.debug("",exception); return; } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java index 3702e9253f..fa1946f987 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java @@ -15,6 +15,8 @@ import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.Validator; @@ -36,6 +38,9 @@ import java.util.Objects; */ public class ValidationTestUtil { + private final static Logger log = (Logger) LoggerFactory.getLogger(ValidationTestUtil.class + .getName()); + public static GlobalValidationContext createGlobalContextFromPath(String path) { GlobalValidationContext globalValidationContext = new GlobalValidationContext(); Map contentMap = getContentMapByPath(path); @@ -71,7 +76,7 @@ public class ValidationTestUtil { fileContent = FileUtils.toByteArray(fis); contentMap.put(file.getName(), fileContent); } catch (IOException e) { - e.printStackTrace(); + log.debug("",e); } } return contentMap; @@ -178,6 +183,7 @@ public class ValidationTestUtil { CommonMethods.newInstance(validatorConf.getImplementationClass(), Validator.class); validator.init(validatorConf.getProperties()); } catch (IllegalArgumentException iae) { + log.debug("",iae); return null; } return validator; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java index 3dcc7da876..41300f3852 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java @@ -17,6 +17,8 @@ import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions; import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; @@ -37,6 +39,7 @@ import static java.util.Objects.nonNull; public class ValidationUtil { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private final static Logger log = (Logger) LoggerFactory.getLogger(ValidationUtil.class.getName()); public static void removeExposedResourcesCalledByGetResource(String fileName, Set actualExposedResources, @@ -138,6 +141,7 @@ public class ValidationUtil { throw new Exception("The file '" + envFileName + "' has no content"); } } catch (Exception exception) { + log.debug("",exception); mdcDataDebugMessage.debugExitMessage("file", envFileName); return null; } @@ -186,6 +190,7 @@ public class ValidationUtil { try { manifestContent = JsonUtil.json2Object(manifest.get(), ManifestContent.class); } catch (Exception exception) { + log.debug("",exception); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.VALIDATE_MANIFEST_CONTENT, ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_MANIFEST); -- cgit 1.2.3-korg