From 811db4c39abb769a14c9b5ab1093b764c8b42a50 Mon Sep 17 00:00:00 2001 From: amshegokar Date: Wed, 20 Sep 2017 14:18:03 +0530 Subject: Sonar Blocker For rest healthcheck Adapter-bundle Change-Id: Ic499d7af6c90cd692e8362ba4f7d2f5d62d48422 Issue-ID: APPC-216 Signed-off-by: Shubhada Ramkrishna Vaze Signed-off-by: Skip Wonnell --- .../appc/adapter/restHealthcheck/impl/RestHealthcheckAdapterImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main') diff --git a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/openecomp/appc/adapter/restHealthcheck/impl/RestHealthcheckAdapterImpl.java b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/openecomp/appc/adapter/restHealthcheck/impl/RestHealthcheckAdapterImpl.java index 094ef3ebe..6cf2eaf39 100644 --- a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/openecomp/appc/adapter/restHealthcheck/impl/RestHealthcheckAdapterImpl.java +++ b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/openecomp/appc/adapter/restHealthcheck/impl/RestHealthcheckAdapterImpl.java @@ -32,6 +32,7 @@ import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.regex.Pattern; +import org.apache.http.impl.client.CloseableHttpClient; import org.openecomp.appc.Constants; import org.openecomp.appc.adapter.restHealthcheck.RestHealthcheckAdapter; @@ -258,9 +259,8 @@ public class RestHealthcheckAdapterImpl implements RestHealthcheckAdapter { RequestContext rc = new RequestContext(ctx); rc.isAlive(); - try { + try(CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpGet httpGet = new HttpGet(tUrl); - HttpClient httpClient = HttpClients.createDefault(); HttpResponse response = null; response = httpClient.execute(httpGet); int responseCode=response.getStatusLine().getStatusCode(); -- cgit 1.2.3-korg