diff options
-rw-r--r-- | appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/onap/appc/adapter/rest/impl/RestAdapterImpl.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/onap/appc/adapter/rest/impl/RestAdapterImpl.java b/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/onap/appc/adapter/rest/impl/RestAdapterImpl.java index bbb37f4cf..b45a5da5c 100644 --- a/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/onap/appc/adapter/rest/impl/RestAdapterImpl.java +++ b/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/onap/appc/adapter/rest/impl/RestAdapterImpl.java @@ -35,6 +35,7 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.glassfish.grizzly.http.util.HttpStatus; @@ -177,8 +178,7 @@ public class RestAdapterImpl implements RestAdapter { } public void executeHttpRequest(HttpRequestBase httpRequest, RequestContext rc){ - try { - HttpClient httpClient = HttpClients.createDefault(); + try (CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpResponse response = httpClient.execute(httpRequest); int responseCode = response.getStatusLine().getStatusCode(); HttpEntity entity = response.getEntity(); |