summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-12-05 16:49:25 +0530
committerSandeep J <sandeejh@in.ibm.com>2018-12-05 16:49:33 +0530
commit3391f0dd1a9fc05e8529fda806dd48504c9510bd (patch)
tree5c39a34ae814ab366d082b36844df7efef00bd58
parent7f8fd751c9272c33be0b74f02cd962dd615b63d3 (diff)
fixed sonar issues in LogFilter.java
to increase code coverage Issue-ID: CCSDK-525 Change-Id: If9ad798ad5e5fc7b4ad97cb83ad79ff379ccb933 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
-rw-r--r--filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java15
1 files changed, 5 insertions, 10 deletions
diff --git a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java
index d7a599cb..4481ab90 100644
--- a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java
+++ b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -84,6 +86,7 @@ public class LogFilter implements Filter {
private static final Logger AUDIT = LoggerFactory.getLogger("org.onap.ccsdk.sli.core.filters.audit");
@Override
public void destroy() {
+ // this method does nothing
}
@Override
@@ -111,6 +114,7 @@ public class LogFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
+ // this method does nothing
}
@@ -134,11 +138,7 @@ public class LogFilter implements Filter {
String userName="unknown";
- /* below returning org.opendaylight.aaa.shiro.realm.TokenAuthRealm$ODLPrincipal@745dfcfe
- if ( request.getUserPrincipal() != null) {
- userName = request.getUserPrincipal().getName();
- }
- */
+
// going directly after Authorization header
if (request.getHeader("Authorization") != null) {
String authzHeader = request.getHeader("Authorization");
@@ -164,12 +164,8 @@ public class LogFilter implements Filter {
private void post(HttpServletRequest request,HttpServletResponse response,long startTime) {
- //AUDIT.info("{}|{}|{}{}",request.getRemoteHost(),request.getMethod(),request.getRequestURL().toString(),request.getQueryString());
- //AUDIT.info(request.getRemoteHost() + D + request.getMethod() + D + request.getRequestURL().toString() + D + request.getQueryString());
- //METRIC.info(request.getMethod() + D + response.getStatus() + D + request.getRequestURL().toString() + D + (System.currentTimeMillis() - startTime) + " ms");
MDC.put(BEGIN_TIMESTAMP,asIso8601(startTime));
MDC.put(END_TIMESTAMP,asIso8601(System.currentTimeMillis()));
- //MDC.put(REQUEST_ID,"already done above");
MDC.put(SERVICE_NAME,request.getRequestURL().toString());
int idx = request.getPathInfo().lastIndexOf(':');
String instance = "";
@@ -179,7 +175,6 @@ public class LogFilter implements Filter {
MDC.put(SERVICE_INSTANCE,instance);
MDC.put(THREAD_ID,"");
MDC.put(PHYSICAL_SERVER_NAME,"");
- //MDC.put(PARTNER_NAME,"already done above");
if ( response.getStatus() >= 400 ) {
MDC.put(STATUS_CODE,"ERROR");
} else {