aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 2f05eb5f2d..29dca19820 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -50,6 +50,7 @@ import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -98,8 +99,7 @@ public class ServicePluginFactory {
new String[] {VS_MONITORED, VS_UNMONITORED, TS_MONITORED, TS_UNMONITORED};
static {
- try {
- InputStream is = ClassLoader.class.getResourceAsStream("/application.properties");
+ try (InputStream is = ClassLoader.class.getResourceAsStream("/application.properties")) {
if (null != is) {
Properties prop = new Properties();
prop.load(is);
@@ -855,14 +855,12 @@ public class ServicePluginFactory {
HttpRequestBase method = null;
HttpResponse httpResponse = null;
- try {
+ try (CloseableHttpClient client = HttpClientBuilder.create().build()) {
int timeout = DEFAULT_TIME_OUT;
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
.setConnectionRequestTimeout(timeout).build();
- HttpClient client = HttpClientBuilder.create().build();
-
if ("POST".equalsIgnoreCase(methodType)) {
HttpPost httpPost = new HttpPost(msbUrl);
httpPost.setConfig(requestConfig);
@@ -902,9 +900,6 @@ public class ServicePluginFactory {
method = null;
return responseContent;
- } catch (SocketTimeoutException | ConnectTimeoutException e) {
- return null;
-
} catch (Exception e) {
return null;
@@ -913,13 +908,14 @@ public class ServicePluginFactory {
try {
EntityUtils.consume(httpResponse.getEntity());
} catch (Exception e) {
+ logger.debug("Exception while executing finally block", e);
}
}
if (method != null) {
try {
method.reset();
} catch (Exception e) {
-
+ logger.debug("Exception while executing finally block", e);
}
}
}