Fixing sonar issues

Replaced URL with URI to avoid
trigger DNS.

Change-Id: If85f1f2780c46e0966f3707af51571f4a7aa2f15
Issue-ID: SDC-2660
Signed-off-by: Dmitry Puzikov <d.puzikov2@partner.samsung.com>
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/NonConfigResource.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/NonConfigResource.java
index 459c8b4..065e7f4 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/NonConfigResource.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/NonConfigResource.java
@@ -17,6 +17,7 @@
 package org.onap.config;
 
 import java.io.File;
+import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -36,9 +37,9 @@
     static final String CONFIG_LOCATION = "config.location";
 
     private final List<Function<String, Path>> lookupFunctions =
-            Arrays.asList(this::getFromFile, this::findInFiles, this::getForNode, this::getGlobal, this::findInUrls);
+            Arrays.asList(this::getFromFile, this::findInFiles, this::getForNode, this::getGlobal, this::findInUris);
 
-    private final Set<URL> urls = Collections.synchronizedSet(new HashSet<>());
+    private final Set<URI> uris = Collections.synchronizedSet(new HashSet<>());
     private final Set<File> files = Collections.synchronizedSet(new HashSet<>());
 
     private final Function<String, String> propertyGetter;
@@ -52,7 +53,7 @@
     }
 
     public void add(URL url) {
-        urls.add(url);
+        uris.add(toUri(url));
     }
 
     public void add(File file) {
@@ -96,15 +97,12 @@
         return new File(resource).exists() ? Paths.get(resource) : null;
     }
 
-    private Path findInUrls(String resource) {
-
-        for (URL url : urls) {
-
-            if (url.getFile().endsWith(resource)) {
-                return Paths.get(toUri(url));
+    private Path findInUris(String resource) {
+        for (URI uri : uris) {
+            if (toUrl(uri).getFile().endsWith(resource)) {
+                return Paths.get(uri);
             }
         }
-
         return null;
     }
 
@@ -139,7 +137,15 @@
         try {
             return url.toURI();
         } catch (URISyntaxException e) {
-            throw new IllegalStateException("Unexpected URL syntax: " + url.toString(), e);
+            throw new IllegalStateException("Unexpected URL syntax: " + url, e);
+        }
+    }
+
+    private static URL toUrl(URI uri) {
+        try {
+            return uri.toURL();
+        } catch (MalformedURLException e) {
+            throw new IllegalStateException("Unexpected URI syntax: " + uri, e);
         }
     }
 }