Repair aspect logger; repair site deploy 07/17207/1
authorChristopher Lott (cl778h) <clott@research.att.com>
Wed, 4 Oct 2017 12:32:30 +0000 (08:32 -0400)
committerChristopher Lott (cl778h) <clott@research.att.com>
Wed, 4 Oct 2017 12:33:33 +0000 (08:33 -0400)
[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) <clott@research.att.com>
ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java
ecomp-portal-widget-ms/widget-ms/pom.xml

index 260c0f7..d095bbd 100644 (file)
@@ -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) == "")) {
index da6eb99..08659cc 100644 (file)
@@ -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>
                <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>
 
                        <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>