From 88c674e9f243ee7bfacfca847383ea01b482c1c1 Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Wed, 4 Oct 2017 08:32:30 -0400 Subject: [PATCH] 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) --- .../portal/logging/aop/EPEELFLoggerAdvice.java | 16 ++-- ecomp-portal-widget-ms/widget-ms/pom.xml | 86 +++++++++++++++++++--- 2 files changed, 82 insertions(+), 20 deletions(-) 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) == "")) { diff --git a/ecomp-portal-widget-ms/widget-ms/pom.xml b/ecomp-portal-widget-ms/widget-ms/pom.xml index da6eb99d..08659cc7 100644 --- a/ecomp-portal-widget-ms/widget-ms/pom.xml +++ b/ecomp-portal-widget-ms/widget-ms/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - + org.springframework.boot spring-boot-starter-parent @@ -135,18 +135,35 @@ ${project.artifactId} - + src/main/resources true - - ../common-widgets/target - - **/*.zip - - - + + ../common-widgets/target + + **/*.zip + + + + + + + + org.apache.maven.plugins + maven-site-plugin + 3.6 + + + org.apache.maven.wagon + wagon-webdav-jackrabbit + 2.10 + + + + + @@ -159,13 +176,62 @@ org.apache.maven.plugins maven-deploy-plugin - 2.8 + true + + org.jacoco + jacoco-maven-plugin + 0.7.6.201602180812 + + + prepare-agent + + prepare-agent + + + ${sonar.jacoco.reportPath} + + + + default-instrument + + instrument + + + + default-restore-instrumented-classes + test + + restore-instrumented-classes + + + + post-unit-test + test + + report + + + ${sonar.jacoco.reportPath} + ${project.basedir}/target/site/jacoco + + + + + + + + + ecomp-site + dav:https://nexus.onap.org/content/sites/site/${project.groupId}/${project.artifactId}/${project.version} + + + -- 2.16.6