diff options
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java | 16 | ||||
-rw-r--r-- | 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"> <modelVersion>4.0.0</modelVersion> - <!-- This project must name Spring as parent; cannot name Portal --> + <!-- This project must name Spring as parent; cannot name Portal --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> @@ -135,18 +135,35 @@ <finalName>${project.artifactId}</finalName> <!-- To add resources, must name all including usual src/main/resources --> - <resources> + <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> - <resource> - <directory>../common-widgets/target</directory> - <includes> - <include>**/*.zip</include> - </includes> - </resource> - </resources> + <resource> + <directory>../common-widgets/target</directory> + <includes> + <include>**/*.zip</include> + </includes> + </resource> + </resources> + + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>3.6</version> + <dependencies> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-webdav-jackrabbit</artifactId> + <version>2.10</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </pluginManagement> <plugins> @@ -159,13 +176,62 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> - <version>2.8</version> + <!-- version set by spring <version>2.8</version> --> <configuration> <skip>true</skip> </configuration> </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.6.201602180812</version> + <executions> + <execution> + <id>prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + <configuration> + <destFile>${sonar.jacoco.reportPath}</destFile> + </configuration> + </execution> + <execution> + <id>default-instrument</id> + <goals> + <goal>instrument</goal> + </goals> + </execution> + <execution> + <id>default-restore-instrumented-classes</id> + <phase>test</phase> + <goals> + <goal>restore-instrumented-classes</goal> + </goals> + </execution> + <execution> + <id>post-unit-test</id> + <phase>test</phase> + <goals> + <goal>report</goal> + </goals> + <configuration> + <dataFile>${sonar.jacoco.reportPath}</dataFile> + <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory> + </configuration> + </execution> + + </executions> + </plugin> </plugins> </build> + <!-- This POM cannot inherit from OParent --> + <distributionManagement> + <site> + <id>ecomp-site</id> + <url>dav:https://nexus.onap.org/content/sites/site/${project.groupId}/${project.artifactId}/${project.version}</url> + </site> + </distributionManagement> + </project> |