diff options
author | Arindam Mondal <arind.mondal@samsung.com> | 2019-05-20 19:12:37 +0900 |
---|---|---|
committer | arind.mondal <arind.mondal@samsung.com> | 2019-05-20 19:34:31 +0900 |
commit | 081132cd8f456d5bd9fcc0aeda1de3545b86dcda (patch) | |
tree | a92fc5aa6bed7450e2a78443015fbff67c0e0969 | |
parent | fd3012251e1d13ae301d19a543fefa80b3cb83db (diff) |
Sonar fix try-with-resources
Issue-ID: VFC-1389
Change-Id: Ie00bff738c48ea600e5a3deda08fc96583860a38
Signed-off-by: arind.mondal <arind.mondal@samsung.com>
-rw-r--r-- | huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java index 9cf2b2ac..8fd3fbeb 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java @@ -78,12 +78,10 @@ public class ConnectMgrVnfm { ConnectInfo info = new ConnectInfo(vnfmObj.getString("url"), vnfmObj.getString(Constant.USERNAME), vnfmObj.getString(Constant.PASSWORD), authModel); - CloseableHttpClient httpClient = HttpClients.createDefault(); - - try { + try (CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpPost httpPost = new HttpPost(info.getUrl()); } catch (Exception e) { - e.printStackTrace(); + LOG.error("Exception while creating connection: {}", e.getMessage()); } return 1; |