From 88c674e9f243ee7bfacfca847383ea01b482c1c1 Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Wed, 4 Oct 2017 08:32:30 -0400 Subject: Repair aspect logger; repair site deploy [PORTAL-54] Javadoc site deployment fails on widget-ms module [PORTAL-116] WidgetCatalog request takes exception before reaching controller method Issue: PORTAL-54, PORTAL-116 Change-Id: Id6d223a30a8c5f493c3fa1902225bc4e8964d085 Signed-off-by: Christopher Lott (cl778h) --- .../portalapp/portal/logging/aop/EPEELFLoggerAdvice.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'ecomp-portal-BE-common') 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) == "")) { -- cgit 1.2.3-korg