aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2017-10-17 14:15:20 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-17 14:15:20 +0000
commitee371e36f97d69732d121db182fe68891a8cd0b8 (patch)
treee8f825c918dfc394bce39823c0866e052021c254 /adapters
parent11b23330798f27085c48e06cbc7fb82304103beb (diff)
parent21cef616e10204d1a03472c381d0645654fc312c (diff)
Merge "Fixed CloseableHttpClient close issue"
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java14
1 files changed, 1 insertions, 13 deletions
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
index 6c571f3e06..f51b27282c 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
@@ -241,9 +241,6 @@ public class BpelRestClient {
LOGGER.debug("Sending to BPEL server: "+bpelUrl);
LOGGER.debug("Content is: "+toBpelStr);
- //Client 4.3+
- CloseableHttpClient client = null;
-
//POST
HttpPost post = new HttpPost(bpelUrl);
if (credentials != null && !credentials.isEmpty())
@@ -263,8 +260,7 @@ public class BpelRestClient {
//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();
@@ -279,14 +275,6 @@ public class BpelRestClient {
LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, error, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception sending Bpel notification", e);
lastResponseCode = 900;
lastResponse = "";
- } finally {
- if(client != null){
- try {
- client.close();
- } catch (IOException e) {
- LOGGER.debug("Exception while closing client", e);
- }
- }
}
LOGGER.debug("Response code from BPEL server: "+lastResponseCode);
LOGGER.debug("Response body is: "+lastResponse);