X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-BE-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fportalapp%2Fportal%2Flogging%2Faop%2FEPEELFLoggerAdvice.java;h=d095bbdb1498eb552f600d4f11a4f7ecf23fd749;hb=88c674e9f243ee7bfacfca847383ea01b482c1c1;hp=260c0f7237492a2a0c98d3fa6119dc4ed9b58c6f;hpb=51d83152697da4f2ef2242471ee43f36e6b64300;p=portal.git diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java index 260c0f72..d095bbdb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java @@ -102,14 +102,11 @@ public class EPEELFLoggerAdvice { */ public Object[] before(SecurityEventTypeEnum securityEventType, Object[] args, Object[] passOnArgs) { String className = ""; - if (passOnArgs[0] != null) { + if (passOnArgs.length > 0 && passOnArgs[0] != null) className = passOnArgs[0].toString(); - } - String methodName = ""; - if (passOnArgs[1] != null) { + if (passOnArgs.length > 1 && passOnArgs[1] != null) methodName = passOnArgs[1].toString(); - } // Initialize Request defaults only for controller methods. MDC.put(className + methodName + EPCommonSystemProperties.METRICSLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC()); @@ -119,7 +116,7 @@ public class EPEELFLoggerAdvice { MDC.put(className + methodName + EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC()); HttpServletRequest req = null; - if (args[0] != null && args[0] instanceof HttpServletRequest) { + if (args.length > 0 && args[0] != null && args[0] instanceof HttpServletRequest) { req = (HttpServletRequest) args[0]; this.setHttpRequestBasedDefaultsIntoGlobalLoggingContext(req, securityEventType, methodName); } @@ -142,12 +139,11 @@ public class EPEELFLoggerAdvice { public void after(SecurityEventTypeEnum securityEventType, String statusCode, String responseCode, Object[] args, Object[] returnArgs, Object[] passOnArgs) { String className = ""; - if (passOnArgs[0] != null) + if (passOnArgs.length > 0 && passOnArgs[0] != null) className = passOnArgs[0].toString(); - // Method Name String methodName = ""; - if (passOnArgs[1] != null) + if (passOnArgs.length > 1 && passOnArgs[1] != null) methodName = passOnArgs[1].toString(); if (MDC.get(EPCommonSystemProperties.TARGET_SERVICE_NAME) == null @@ -167,7 +163,7 @@ public class EPEELFLoggerAdvice { // Making sure to reload the INCOMING request MDC defaults if they have // been wiped out by either Outgoing or LDAP Phone book search // operations. - if (securityEventType != null && args[0] != null && args[0] instanceof HttpServletRequest + if (securityEventType != null && args.length > 0 && args[0] != null && args[0] instanceof HttpServletRequest && securityEventType == SecurityEventTypeEnum.INCOMING_REST_MESSAGE && (MDC.get(EPCommonSystemProperties.FULL_URL) == null || MDC.get(EPCommonSystemProperties.FULL_URL) == "")) {