Bug 6413: Fix ipv4 and ipv6 patterns used by IpAddressNoZoneBuilder
[mdsal.git] / model / ietf / ietf-inet-types-2013-07-15 / src / main / java / org / opendaylight / yang / gen / v1 / urn / ietf / params / xml / ns / yang / ietf / inet / types / rev130715 / IpAddressNoZoneBuilder.java
index 4d63a3588eba953a9e9240d3f31bd875c9840aa7..57cd66682883e0bbd035a8a861d69f705c5c3894 100644 (file)
@@ -8,12 +8,8 @@
 
 package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715;
 
-import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-
-/**
- */
 public class IpAddressNoZoneBuilder {
 
     private static final Pattern IPV4_NO_ZONE_PATTERN =
@@ -21,17 +17,8 @@ public class IpAddressNoZoneBuilder {
     private static final Pattern IPV6_NO_ZONE_PATTERN1 =
         Pattern.compile("[0-9a-fA-F:\\.]*");
 
-
     public static IpAddressNoZone getDefaultInstance(final String defaultValue) {
-        final Matcher ipv4NoZoneMatcher = IPV4_NO_ZONE_PATTERN.matcher(defaultValue);
-
-        if (ipv4NoZoneMatcher.matches()) {
-            if (IPV6_NO_ZONE_PATTERN1.matcher(defaultValue).matches()) {
-                throw new IllegalArgumentException(
-                    String.format("Cannot create IpNoZoneAddress from \"%s\", matches both %s and %s",
-                        defaultValue, Ipv4AddressNoZone.class.getSimpleName(), Ipv6AddressNoZone.class.getSimpleName()));
-
-            }
+        if (IPV4_NO_ZONE_PATTERN.matcher(defaultValue).matches()) {
             return new IpAddressNoZone((new Ipv4AddressNoZone(defaultValue)));
         } else if (IPV6_NO_ZONE_PATTERN1.matcher(defaultValue).matches()) {
             return new IpAddressNoZone((new Ipv6AddressNoZone(defaultValue)));
@@ -39,5 +26,4 @@ public class IpAddressNoZoneBuilder {
             throw new IllegalArgumentException("Cannot create IpAddress from " + defaultValue);
         }
     }
-
-}
+}
\ No newline at end of file