summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);