From 36b62be84b398044e1feae657c662dba6247782f Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 29 Mar 2018 20:26:02 -0500 Subject: Clean up Sonar results 2 Issue-ID: AAF-206 Change-Id: Ia000b144be58af970f4a5264ca5a9718fdbf9f5d Signed-off-by: Instrumental --- .../org/onap/aaf/cadi/locator/PropertyLocator.java | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'cadi/client/src/main') diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java index 244a43bd..5820bf29 100644 --- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java +++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java @@ -193,17 +193,21 @@ public class PropertyLocator implements Locator { port = "https".equalsIgnoreCase(o.getScheme())?443:80; } socket.connect(new InetSocketAddress(realname,port),3000); - if(socket.isConnected()) { - n = new URI( - o.getScheme(), - o.getUserInfo(), - realname, - o.getPort(), - o.getPath(), - o.getQuery(), - o.getFragment() - ); - resolve.add(n); + try { + if(socket.isConnected()) { + n = new URI( + o.getScheme(), + o.getUserInfo(), + realname, + o.getPort(), + o.getPath(), + o.getQuery(), + o.getFragment() + ); + resolve.add(n); + } + } finally { + socket.close(); } } catch (IOException e) { } finally { -- cgit 1.2.3-korg