diff options
Diffstat (limited to 'common-logging/src/main/java')
3 files changed, 33 insertions, 34 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingUtils.java b/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingUtils.java index dddd3c4d..6c0879ea 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingUtils.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingUtils.java @@ -24,7 +24,9 @@ import javax.servlet.http.HttpServletRequest; public class OnapLoggingUtils { - private OnapLoggingUtils() {} + private OnapLoggingUtils() { + // Private constructor to prevent subclassing + } /** * Get the ONAPLoggingContext for a request. @@ -34,7 +36,7 @@ public class OnapLoggingUtils { * @return the ONAPLoggingContext */ public static OnapLoggingContext getLoggingContextForRequest(HttpServletRequest request, - OnapLoggingContext baseContext) { + OnapLoggingContext baseContext) { OnapLoggingContext requestContext = new OnapLoggingContext(baseContext); if (request.getLocalAddr() != null) { // may be null in junit tests requestContext.setServerIpAddress(request.getLocalAddr()); @@ -58,5 +60,4 @@ public class OnapLoggingUtils { return requestContext; } - } diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java index 4ae4068c..fab0415b 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,56 +29,50 @@ public class ErrorCodeMap { private static final EnumMap<MessageCodes, ErrorCodeInfo> hm = new EnumMap<>(MessageCodes.class); + private static final String CHECK_ERROR_MESSAGE = " Please check the error message for detail information"; + private static final String ERROR_PERMISSIONS = "POLICY-100E"; - private static final String ERROR_PERMISSIONS_DESCRIPTION = - "This is a Permissions Error. Please check the error message for detail information"; + private static final String ERROR_PERMISSIONS_DESCRIPTION = "This is a Permissions Error." + CHECK_ERROR_MESSAGE; private static final String ERROR_SCHEMA_INVALID = "POLICY-400E"; - private static final String ERROR_SCHEMA_INVALID_DESCRIPTION = - "This is an Invalid Schema Error. Please check the error message for detail information"; + private static final String ERROR_SCHEMA_INVALID_DESCRIPTION = "This is an Invalid Schema Error." + + CHECK_ERROR_MESSAGE; private static final String UPDATE_ERROR = "POLICY-502E"; - private static final String UPDATE_ERROR_DESCRIPTION = - "This is an updating error. Please check the error message for detail information"; + private static final String UPDATE_ERROR_DESCRIPTION = "This is an updating error." + CHECK_ERROR_MESSAGE; private static final String EXCEPTION_ERROR_CODE = "POLICY-503E"; - private static final String EXCEPTION_ERROR_DESCRIPTION = - "This is an exception error message during the process. Please check the error message for detail " - + "information"; + private static final String EXCEPTION_ERROR_DESCRIPTION = "This is an exception error message during the process." + + CHECK_ERROR_MESSAGE; private static final String MISS_PROPERTY_ERROR = "POLICY-504E"; - private static final String MISS_PROPERTY_ERROR_DESCRIPTION = - "This is an error of missing properties. Please check the error message for detail information"; + private static final String MISS_PROPERTY_ERROR_DESCRIPTION = "This is an error of missing properties." + + CHECK_ERROR_MESSAGE; private static final String GENERAL_ERROR_CODE = "POLICY-515E"; - private static final String GENERAL_ERROR_DESCRIPTION = - "This is a general error message during the process. Please check the error message for detail information"; + private static final String GENERAL_ERROR_DESCRIPTION = "This is a general error message during the process." + + CHECK_ERROR_MESSAGE; private static final String ERROR_SYSTEM_ERROR = "POLICY-516E"; - private static final String ERROR_SYSTEM_ERROR_DESCRIPTION = - "This is a System Error. Please check the error message for detail information"; + private static final String ERROR_SYSTEM_ERROR_DESCRIPTION = "This is a System Error." + CHECK_ERROR_MESSAGE; private static final String ERROR_DATA_ISSUE = "POLICY-517E"; - private static final String ERROR_DATA_ISSUE_DESCRIPTION = - "This is a Data Issue Error. Please check the error message for detail information"; + private static final String ERROR_DATA_ISSUE_DESCRIPTION = "This is a Data Issue Error." + CHECK_ERROR_MESSAGE; private static final String ERROR_PROCESS_FLOW = "POLICY-518E"; - private static final String ERROR_PROCESS_FLOW_DESCRIPTION = - "This is a Process Flow Error. Please check the error message for detail information"; + private static final String ERROR_PROCESS_FLOW_DESCRIPTION = "This is a Process Flow Error." + CHECK_ERROR_MESSAGE; private static final String ERROR_UNKNOWN = "POLICY-519E"; - private static final String ERROR_UNKNOWN_DESCRIPTION = - "This is an Unknown Error. Please check the error message for detail information"; + private static final String ERROR_UNKNOWN_DESCRIPTION = "This is an Unknown Error." + CHECK_ERROR_MESSAGE; private static final String ERROR_AUDIT = "POLICY-520E"; - private static final String ERROR_AUDIT_DESCRIPTION = - "This is an audit Error. Please check the error message for detail information"; + private static final String ERROR_AUDIT_DESCRIPTION = "This is an audit Error." + CHECK_ERROR_MESSAGE; static { hm.put(MessageCodes.EXCEPTION_ERROR, new ErrorCodeInfo(EXCEPTION_ERROR_CODE, EXCEPTION_ERROR_DESCRIPTION)); hm.put(MessageCodes.GENERAL_ERROR, new ErrorCodeInfo(GENERAL_ERROR_CODE, GENERAL_ERROR_DESCRIPTION)); hm.put(MessageCodes.MISS_PROPERTY_ERROR, - new ErrorCodeInfo(MISS_PROPERTY_ERROR, MISS_PROPERTY_ERROR_DESCRIPTION)); + new ErrorCodeInfo(MISS_PROPERTY_ERROR, MISS_PROPERTY_ERROR_DESCRIPTION)); hm.put(MessageCodes.UPDATE_ERROR, new ErrorCodeInfo(UPDATE_ERROR, UPDATE_ERROR_DESCRIPTION)); hm.put(MessageCodes.ERROR_SYSTEM_ERROR, new ErrorCodeInfo(ERROR_SYSTEM_ERROR, ERROR_SYSTEM_ERROR_DESCRIPTION)); hm.put(MessageCodes.ERROR_DATA_ISSUE, new ErrorCodeInfo(ERROR_DATA_ISSUE, ERROR_DATA_ISSUE_DESCRIPTION)); @@ -86,12 +80,14 @@ public class ErrorCodeMap { hm.put(MessageCodes.ERROR_DATA_ISSUE, new ErrorCodeInfo(ERROR_DATA_ISSUE, ERROR_DATA_ISSUE_DESCRIPTION)); hm.put(MessageCodes.ERROR_PROCESS_FLOW, new ErrorCodeInfo(ERROR_PROCESS_FLOW, ERROR_PROCESS_FLOW_DESCRIPTION)); hm.put(MessageCodes.ERROR_SCHEMA_INVALID, - new ErrorCodeInfo(ERROR_SCHEMA_INVALID, ERROR_SCHEMA_INVALID_DESCRIPTION)); + new ErrorCodeInfo(ERROR_SCHEMA_INVALID, ERROR_SCHEMA_INVALID_DESCRIPTION)); hm.put(MessageCodes.ERROR_UNKNOWN, new ErrorCodeInfo(ERROR_UNKNOWN, ERROR_UNKNOWN_DESCRIPTION)); hm.put(MessageCodes.ERROR_AUDIT, new ErrorCodeInfo(ERROR_AUDIT, ERROR_AUDIT_DESCRIPTION)); } - private ErrorCodeMap() {} + private ErrorCodeMap() { + // Private constructor to prevent subclassing + } public static ErrorCodeInfo getErrorCodeInfo(MessageCodes messageCode) { return hm.get(messageCode); diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/Slf4jLoggingContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/Slf4jLoggingContext.java index 80bb2383..33e9f637 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/Slf4jLoggingContext.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/Slf4jLoggingContext.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,9 @@ import org.slf4j.MDC; * */ public class Slf4jLoggingContext implements LoggingContext { - public Slf4jLoggingContext(LoggingContext base) {} + public Slf4jLoggingContext(LoggingContext base) { + // Default constructor + } @Override public void put(String key, String value) { |