summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-01-19 05:48:48 +0000
committerGerrit Code Review <gerrit@onap.org>2018-01-19 05:48:48 +0000
commit1b9f60bf292b24a33df33cedacad83bb868b450c (patch)
tree72266b001ba3c67f54c26c7db61b1d8ddef7d55a
parentc1ea02430b19245a8fc8a64b7e5644dd0caadc2f (diff)
parent3c335070cb5f653956f419e7fee29282a45b9f96 (diff)
Merge "Sonar blocker issue - NullPointerExeption"
-rw-r--r--adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java16
1 files changed, 1 insertions, 15 deletions
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java
index a8189925fb..749b9f9fc3 100644
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java
@@ -256,13 +256,9 @@ public class BpelRestClient {
.build();
post.setConfig(requestConfig);
- //Client 4.3+
- CloseableHttpClient client = null;
-
//Client 4.3+
//Execute & GetResponse
- try {
- client = HttpClients.createDefault();
+ try(CloseableHttpClient client = HttpClients.createDefault()) {
CloseableHttpResponse response = client.execute(post);
if (response != null) {
lastResponseCode = response.getStatusLine().getStatusCode();
@@ -277,16 +273,6 @@ public class BpelRestClient {
LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, error, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Error sending Bpel notification", e);
lastResponseCode = 900;
lastResponse = "";
- } finally {
- try {
- client.close();
- } catch (IOException e) {
- // ignore
- LOGGER.debug("IOException: ", e);
- } catch (NullPointerException e) {
- //ignore
- LOGGER.debug("NullPointerException: ", e);
- }
}
LOGGER.debug("Response code from BPEL server: "+lastResponseCode);
LOGGER.debug("Response body is: "+lastResponse);