diff options
author | shashikanth.vh <shashikanth.vh@huawei.com> | 2017-10-17 16:20:15 +0530 |
---|---|---|
committer | Shashikanth VH <shashikanth.vh@huawei.com> | 2017-10-17 11:03:04 +0000 |
commit | 21cef616e10204d1a03472c381d0645654fc312c (patch) | |
tree | f236ccf8940cebdc28e8dce17649d338aeb0bddf /adapters/mso-network-adapter/src/main | |
parent | 913ca71caf1fee02247b4ddfa589d551f1dda05a (diff) |
Fixed CloseableHttpClient close issue
Issue-id: SO-228
Change-Id: I731227f4728d3eee5ce84b358c6422a44efdbdc3
Signed-off-by: shashikanth.vh <shashikanth.vh@huawei.com>
Diffstat (limited to 'adapters/mso-network-adapter/src/main')
-rw-r--r-- | adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java | 14 |
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); |