diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2018-12-05 16:49:25 +0530 |
---|---|---|
committer | Sandeep J <sandeejh@in.ibm.com> | 2018-12-05 16:49:33 +0530 |
commit | 3391f0dd1a9fc05e8529fda806dd48504c9510bd (patch) | |
tree | 5c39a34ae814ab366d082b36844df7efef00bd58 /filters | |
parent | 7f8fd751c9272c33be0b74f02cd962dd615b63d3 (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>
Diffstat (limited to 'filters')
-rw-r--r-- | filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java | 15 |
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 d7a599cb3..4481ab904 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 { |