Fix DNSLocator when Network Disconnect 67/99867/1
authorInstrumental <jonathan.gathman@att.com>
Fri, 20 Dec 2019 18:48:07 +0000 (12:48 -0600)
committerInstrumental <jonathan.gathman@att.com>
Fri, 20 Dec 2019 18:48:24 +0000 (12:48 -0600)
Issue-ID: AAF-1060
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Change-Id: I88cdfc917470af8217273fe96db66604601345bf

cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java

index 53782b3..f6edfd1 100644 (file)
@@ -103,10 +103,12 @@ public class DNSLocator implements SizedLocator<URI> {
 
     @Override
     public boolean hasItems() {
-        for (Host h : hosts) {
+        if(hosts!=null) {
+          for (Host h : hosts) {
             if (h.status==Status.OK) {
                 return true;
             }
+          }
         }
         return false;
     }
@@ -239,11 +241,11 @@ public class DNSLocator implements SizedLocator<URI> {
      *
      */
     public interface DNSLookup {
-       InetAddress[] getAllByName(String host) throws UnknownHostException;
-       public static final DNSLookup dflt = new DNSLookup() {
-               public InetAddress[] getAllByName(String host) throws UnknownHostException {
-                       return InetAddress.getAllByName(host);
-               }
+        InetAddress[] getAllByName(String host) throws UnknownHostException;
+        public static final DNSLookup dflt = new DNSLookup() {
+        public InetAddress[] getAllByName(String host) throws UnknownHostException {
+        return InetAddress.getAllByName(host);
+        }
        };
     }