diff options
author | Arindam Mondal <arind.mondal@samsung.com> | 2020-03-20 11:50:43 +0900 |
---|---|---|
committer | 몬달아린담/Network Automation그룹(네트워크)/Staff Engineer/삼성전자 <arind.mondal@samsung.com> | 2020-03-20 11:51:50 +0900 |
commit | 4a0e63de303169e653758943858ec7fa9d52af16 (patch) | |
tree | 45882cf9356a79c819f7f47f87481128906f90ea | |
parent | 2519830412e7c3724955636a5f2f61b4f81ad15a (diff) |
Fix sonar issues
Issue-ID: EXTAPI-416
+) Format logger
++) remove toString()
Change-Id: Ic119a752fa7624f4363706457e25b43d72671361
Signed-off-by: Arindam Mondal <arind.mondal@samsung.com>
-rw-r--r-- | src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java index 9729202..ef1a734 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java @@ -87,6 +87,7 @@ public class MultiClient { private static final String HEADER_AUTHORIZATION = "Authorization"; private static final String X_FROM_APP_ID = "X-FromAppId"; private static final String X_TRANSACTION_ID = "X-TransactionId"; + private static final String EXCEPTION_STRING = "error on calling"; private static final Logger LOGGER = LoggerFactory.getLogger(MultiClient.class); @@ -244,17 +245,17 @@ public class MultiClient { try { ResponseEntity<Object> response = restTemplate.exchange(callUrl, HttpMethod.PUT, new HttpEntity<>(param, httpHeaders), Object.class); - LOGGER.info("response status : " + response.getStatusCodeValue()); + LOGGER.info("response status :{} " , response.getStatusCodeValue()); if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.CREATED)) { LOGGER.warn("HTTP call on {} returns {} , {}", callUrl, response.getStatusCodeValue(), - response.getBody().toString()); + response.getBody()); } return response; } catch (BackendFunctionalException e) { - LOGGER.error("error on calling " + callUrl + " ," + e); + LOGGER.error(EXCEPTION_STRING , callUrl , e); return new ResponseEntity<>("problem calling onap services", e.getHttpStatus()); } catch (ResourceAccessException e) { - LOGGER.error("error on calling " + callUrl + " ," + e); + LOGGER.error(EXCEPTION_STRING , callUrl , e); return new ResponseEntity<>("unable to reach onap services", HttpStatus.INTERNAL_SERVER_ERROR); } } @@ -272,21 +273,21 @@ public class MultiClient { ResponseEntity<Object> response = restTemplate.exchange(uri, HttpMethod.GET, new HttpEntity<>(httpHeaders), Object.class); if (LOGGER.isDebugEnabled()) { - LOGGER.debug("response body : {}", response.getBody().toString()); + LOGGER.debug("response body : {}", response.getBody()); } LOGGER.info("response status : {}", response.getStatusCodeValue()); if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) { LOGGER.warn("HTTP call on {} returns {} , {}", callURL, response.getStatusCodeValue(), - response.getBody().toString()); + response.getBody()); } return response; } catch (BackendFunctionalException e) { - LOGGER.error("error on calling " + callURL + " ," + e); + LOGGER.error(EXCEPTION_STRING,callURL , e); return new ResponseEntity<>("problem calling onap services", e.getHttpStatus()); } catch (ResourceAccessException e) { - LOGGER.error("error on calling " + callURL + " ," + e); + LOGGER.error(EXCEPTION_STRING , callURL, e); return new ResponseEntity<>("unable to reach onap services", HttpStatus.INTERNAL_SERVER_ERROR); } |