diff options
author | Liard Samuel <samuel.liard@orange.com> | 2021-06-30 19:06:16 +0200 |
---|---|---|
committer | Samuel Liard <samuel.liard@gmail.com> | 2021-07-02 09:30:45 +0200 |
commit | a2f7d11ca0bd58ec6c252111ddd3d5dfac0e4c70 (patch) | |
tree | 2c12ab019a9456d928da715198b4bb91b3678b36 /aai-els-onap-logging/src/main/java/org/onap | |
parent | fe71e2611b2bfecc65ef121631360b4c32ca129e (diff) |
Fix all blocker sonar issues and some checkstyle
Issue-ID: AAI-3362
Signed-off-by: sliard <samuel.liard@gmail.com>
Change-Id: I365be3e8afe75b54f5a65deadb054df73857274e
Diffstat (limited to 'aai-els-onap-logging/src/main/java/org/onap')
-rw-r--r-- | aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptor.java | 15 | ||||
-rw-r--r-- | aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfig.java | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptor.java b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptor.java index 51824b74..629587d5 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptor.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptor.java @@ -19,22 +19,19 @@ */ package org.onap.aai.aailog.filter; +import java.io.IOException; +import java.util.List; +import java.util.UUID; import org.onap.aai.aailog.logs.ServiceName; import org.onap.logging.filter.base.AbstractMetricLogFilter; import org.onap.logging.filter.base.Constants; -import org.onap.logging.filter.base.MDCSetup; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.client.ClientHttpResponse; -import org.springframework.http.HttpHeaders; - -import javax.ws.rs.core.MultivaluedMap; -import java.io.IOException; -import java.util.List; -import java.util.UUID; public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRequest, ClientHttpResponse, HttpHeaders> implements ClientHttpRequestInterceptor { @Override @@ -61,8 +58,8 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe String requestId = extractRequestID(requestHeaders); addHeader(requestHeaders, ONAPLogConstants.Headers.REQUEST_ID, requestId); addHeader(requestHeaders, Constants.HttpHeaders.HEADER_REQUEST_ID, requestId); - if (requestHeaders.getFirst(Constants.HttpHeaders.TRANSACTION_ID) == null || - requestHeaders.getFirst(Constants.HttpHeaders.TRANSACTION_ID).isEmpty()) { + String transactionId = requestHeaders.getFirst(Constants.HttpHeaders.TRANSACTION_ID); + if (transactionId == null || transactionId.isEmpty()) { addHeader(requestHeaders, Constants.HttpHeaders.TRANSACTION_ID, requestId); } addHeader(requestHeaders, Constants.HttpHeaders.ECOMP_REQUEST_ID, requestId); diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfig.java b/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfig.java index 8d3e2cc8..2428f1e9 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfig.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfig.java @@ -58,7 +58,7 @@ public class AAIConfig { AAIConfig.getConfigFile(); AAIConfig.reloadConfig(); - if (AAIConstants.AAI_NODENAME == null || AAIConstants.AAI_NODENAME == "") { + if (AAIConstants.AAI_NODENAME == null || AAIConstants.AAI_NODENAME.equals("")) { ErrorLogHelper.logError("AAI_4005", " AAI_NODENAME is not defined"); } else { LOGGER.info("A&AI Server Node Name = " + AAIConstants.AAI_NODENAME); |