commit | 77d99491b26e61294af69e5cb209ea2a1a66a4a4 | [log] [tgz] |
---|---|---|
author | Sovietaced <Sovietaced@gmail.com> | Tue Jun 24 12:58:47 2014 -0700 |
committer | Sovietaced <Sovietaced@gmail.com> | Tue Jun 24 12:58:47 2014 -0700 |
tree | c8b54521ff37aaa0af3c19d6bc062f8798d1b37a | |
parent | 07cc8eb32c4bb3f77ac57765370f5c607aa4cb7a [diff] |
return false for incompatible ip versions
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java index 3d14acf..3cb9ae4 100644 --- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java +++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
@@ -80,14 +80,18 @@ return IPv4AddressWithMask.of(ipv4, IPv4Address.of(mask)); } } - + @Override public boolean contains(IPAddress<?> ip) { if (ip == null) { throw new NullPointerException("ip must not be null"); } - - IPv4Address ipv4 = (IPv4Address) ip; - return this.matches(ipv4); + + if(ip.getIpVersion() == IPVersion.IPv4) { + IPv4Address ipv4 = (IPv4Address) ip; + return this.matches(ipv4); + } + + return false; } }
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java index 2e7ff5e..4fd9b1c 100644 --- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java +++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java
@@ -90,12 +90,15 @@ @Override public boolean contains(IPAddress<?> ip) { - if (string == null) { - throw new NullPointerException("String must not be null"); + if (ip == null) { + throw new NullPointerException("ip must not be null"); } - - IPv6Address ipv6 = (IPv6Address) ip; - return this.matches(ipv6); - } + if(ip.getIpVersion() == IPVersion.IPv6) { + IPv6Address ipv6 = (IPv6Address) ip; + return this.matches(ipv6); + } + + return false; + } }