From 693a3f26aba6104fad1659d9b481cbdd0b75d6d8 Mon Sep 17 00:00:00 2001 From: vempo Date: Thu, 1 Feb 2018 17:13:50 +0200 Subject: Removed unnecessary log constants Removed unnecessary constants associated with logging. Moved remaining constants close to their respective business logic. Change-Id: I3497479a2edcf2c98dca888b2aed52cb2a98e86b Issue-ID: SDC-772 Signed-off-by: vempo --- .../heattotosca/globaltypes/GlobalTypesServiceTemplates.java | 7 ++++--- .../java/org/openecomp/sdc/translator/utils/ResourceWalker.java | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib') diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplates.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplates.java index 5490452155..99f550e8e4 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplates.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplates.java @@ -20,7 +20,6 @@ import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; import org.openecomp.sdc.tosca.services.ToscaUtil; @@ -32,6 +31,8 @@ import java.util.Map; public class GlobalTypesServiceTemplates { + private static final String FAILED_TO_GENERATE_GLOBAL_TYPES = "Failed to generate globalTypes"; + private static final Map> onboardingGlobalTypesServiceTemplates; @@ -46,7 +47,7 @@ public class GlobalTypesServiceTemplates { throw coreException; } catch (Exception exception) { throw new CoreException((new ErrorCode.ErrorCodeBuilder()) - .withMessage(LoggerErrorDescription.FAILED_TO_GENERATE_GLOBAL_TYPES) + .withMessage(FAILED_TO_GENERATE_GLOBAL_TYPES) .withId("GlobalTypes Read Error").withCategory(ErrorCategory.APPLICATION).build(), exception); } @@ -57,7 +58,7 @@ public class GlobalTypesServiceTemplates { onboardingType) { if (onboardingType == null) { throw new CoreException((new ErrorCode.ErrorCodeBuilder()) - .withMessage(LoggerErrorDescription.FAILED_TO_GENERATE_GLOBAL_TYPES) + .withMessage(FAILED_TO_GENERATE_GLOBAL_TYPES) .withId("Invalid Onboarding Type").withCategory(ErrorCategory.APPLICATION).build()); } return onboardingGlobalTypesServiceTemplates.get(onboardingType); diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/utils/ResourceWalker.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/utils/ResourceWalker.java index dfeea57163..e5993677cd 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/utils/ResourceWalker.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/utils/ResourceWalker.java @@ -20,7 +20,6 @@ import org.apache.commons.io.IOUtils; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; import java.io.BufferedReader; import java.io.File; @@ -42,6 +41,8 @@ import java.util.zip.ZipFile; public class ResourceWalker { + private static final String RESOURCE_FILE_READ_ERROR = "Can't read resource file from class path."; + private ResourceWalker() { } @@ -61,7 +62,7 @@ public class ResourceWalker { filesContent.put(fileName, IOUtils.toString(reader)); } catch (IOException exception) { throw new CoreException((new ErrorCode.ErrorCodeBuilder()) - .withMessage(LoggerErrorDescription.RESOURCE_FILE_READ_ERROR + .withMessage(RESOURCE_FILE_READ_ERROR + " File name = " + fileName) .withId("Resource Read Error").withCategory(ErrorCategory.APPLICATION).build(), exception); -- cgit 1.2.3-korg