check for invalid masks in getSubnetBroadcastAddress in IPAWithMask
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java
index ada2d38..f9eefc1 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java
@@ -10,6 +10,10 @@
     public abstract IPVersion getIpVersion();
 
     public IPAddress<?> getSubnetBroadcastAddress() {
+        if (!mask.isCidrMask()) {
+            throw new IllegalArgumentException("Mask Invalid " + mask +
+                                               " cannot get subnet for non CIDR mask");
+        }
         return value.or(mask.not());
     }
 
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
index bd2c945..a57b42a 100644
--- a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
@@ -359,5 +359,13 @@
         } catch (NullPointerException e) {
             assertNotNull(e.getMessage());
         }
+        try {
+            IPv4AddressWithMask.of(IPv4Address.of("10.10.10.0"),
+                                   IPv4Address.of("255.0.255.0"))
+                                   .getSubnetBroadcastAddress();
+            fail("Should have thrown IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            assertNotNull(e.getMessage());
+        }
     }
 }
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
index da31470..6963c21 100644
--- a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
@@ -305,5 +305,13 @@
         } catch (NullPointerException e) {
             assertNotNull(e.getMessage());
         }
+        try {
+            IPv6AddressWithMask.of(IPv6Address.of("10:10::0"),
+                                   IPv6Address.of("ffff:0:ffff::"))
+                                   .getSubnetBroadcastAddress();
+            fail("Should have thrown IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            assertNotNull(e.getMessage());
+        }
     }
 }