Catch only the exceptions thrown by InetAddress.getByName 60/17160/1
authorSam Hague <shague@redhat.com>
Thu, 26 Mar 2015 14:10:45 +0000 (10:10 -0400)
committerSam Hague <shague@redhat.com>
Thu, 26 Mar 2015 14:10:45 +0000 (10:10 -0400)
Change-Id: Idda91acd51a5c256a4094ca42b049aa171d2aafa
Signed-off-by: Sam Hague <shague@redhat.com>
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSubnet.java

index 9fce97eeba303531c93f5bf22b71bb6e4139b328..c5534b5cbdcf887d6b7897166d96667ad3d0f3f7 100644 (file)
@@ -9,9 +9,11 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
+import java.lang.Exception;
 import java.math.BigInteger;
 import java.net.InetAddress;
 import java.net.Inet6Address;
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -291,7 +293,7 @@ public class NeutronSubnet implements Serializable, INeutronObject {
                     }
                 }
                 return(true);
-            } catch (Exception e) {
+            } catch (UnknownHostException e) {
                 return(false);
             }
         }
@@ -404,6 +406,7 @@ public class NeutronSubnet implements Serializable, INeutronObject {
                 return false;
             }
         }
+
         if (ipVersion == 6) {
             String[] parts = cidr.split("/");
             try {
@@ -418,7 +421,7 @@ public class NeutronSubnet implements Serializable, INeutronObject {
                     }
                 }
                 return(true);
-            } catch (Exception e) {
+            } catch (UnknownHostException e) {
                 return(false);
             }
         }