From: Driptaroop Das Date: Thu, 10 Jan 2019 06:36:06 +0000 (+0530) Subject: AAIAuthCore-replace duplicate literal by constant X-Git-Tag: 1.4.2~17^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=d3f777567f46e72dcad391cb8cfc724d3d8c7588;p=aai%2Faai-common.git AAIAuthCore-replace duplicate literal by constant Sonar Fix (AAIAuthCore.java - Define a constant instead of duplicating this literal "AAI_4001" 3 times.) Issue-ID: AAI-2065 Change-Id: Ic9c343f814dc220fe118b21ae08f29a65a337da7 Signed-off-by: Driptaroop Das --- diff --git a/aai-core/src/main/java/org/onap/aai/auth/AAIAuthCore.java b/aai-core/src/main/java/org/onap/aai/auth/AAIAuthCore.java index 1572ec72..5097ef41 100644 --- a/aai-core/src/main/java/org/onap/aai/auth/AAIAuthCore.java +++ b/aai-core/src/main/java/org/onap/aai/auth/AAIAuthCore.java @@ -53,6 +53,8 @@ public final class AAIAuthCore { private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AAIAuthCore.class); + private static final String ERROR_CODE_AAI_4001 = "AAI_4001"; + private String globalAuthFileName = AAIConstants.AAI_AUTH_CONFIG_FILENAME; private final Pattern AUTH_POLICY_PATTERN; @@ -161,11 +163,11 @@ public final class AAIAuthCore { } } } catch (FileNotFoundException e) { - ErrorLogHelper.logError("AAI_4001", globalAuthFileName + ". Exception: " + e); + ErrorLogHelper.logError(ERROR_CODE_AAI_4001, globalAuthFileName + ". Exception: " + e); } catch (JsonProcessingException e) { - ErrorLogHelper.logError("AAI_4001", globalAuthFileName + ". Not valid JSON: " + e); + ErrorLogHelper.logError(ERROR_CODE_AAI_4001, globalAuthFileName + ". Not valid JSON: " + e); } catch (Exception e) { - ErrorLogHelper.logError("AAI_4001", globalAuthFileName + ". Exception caught: " + e); + ErrorLogHelper.logError(ERROR_CODE_AAI_4001, globalAuthFileName + ". Exception caught: " + e); } }