diff options
author | r.bogacki <r.bogacki@samsung.com> | 2019-05-30 15:16:57 +0200 |
---|---|---|
committer | r.bogacki <r.bogacki@samsung.com> | 2019-05-30 15:19:15 +0200 |
commit | 3dc507947c81807371babbd275d7caf0c3521e5d (patch) | |
tree | 77011f63ee4838b6bd94f847e9690bae1649f37d /mso-api-handlers/mso-api-handler-common/src/main/java | |
parent | af23464d5dcac4aa493fde21fb1beff40c5e1b9c (diff) |
Improvements in RequestClientFactory
Improvements in RequestClientFactory according to the Sonar analysis.
Fixed imports.
Removed unnecessary exceptions handling.
Replaced depreciated DefaultHttpClient with a new one.
Issue-ID: SO-1947
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Change-Id: Id497bfb620775aac67ad4c5f6d57e0fccce4fd34
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common/src/main/java')
-rw-r--r-- | mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java index 4149d5ee45..c2ffa7e004 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java @@ -4,6 +4,9 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,9 +23,7 @@ package org.onap.so.apihandler.common; - - -import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -34,7 +35,7 @@ public class RequestClientFactory { private Environment env; // based on URI, returns BPEL, CamundaTask or Camunda client - public RequestClient getRequestClient(String orchestrationURI) throws IllegalStateException { + public RequestClient getRequestClient(String orchestrationURI) { RequestClient retClient; String url; @@ -45,7 +46,7 @@ public class RequestClientFactory { url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI; retClient = new CamundaClient(); } - retClient.setClient(new DefaultHttpClient()); + retClient.setClient(HttpClientBuilder.create().build()); retClient.setProps(env); retClient.setUrl(url); return retClient; |