@Test public void testRejectNullSubnetIPv4() { assertFalse(IPUtils.isValidIpv4Subnet(null)); }
public static final boolean isValidIpv4Subnet(String in) { String ip; String subnet; Matcher ipMatcher; if (in == null) { return false; } ipMatcher = subnetPattern.matcher(in); int subnetint; if (ipMatcher.find()) { ip = ipMatcher.group(1); subnet = ipMatcher.group(2); try { subnetint = Integer.parseInt(subnet); if (subnetint < 0 || subnetint > 32 || !isValidIpv4String(ip)) { return false; } return true; } catch (NumberFormatException e) { return false; } } return false; }
IPUtils { public static final boolean isValidIpv4Subnet(String in) { String ip; String subnet; Matcher ipMatcher; if (in == null) { return false; } ipMatcher = subnetPattern.matcher(in); int subnetint; if (ipMatcher.find()) { ip = ipMatcher.group(1); subnet = ipMatcher.group(2); try { subnetint = Integer.parseInt(subnet); if (subnetint < 0 || subnetint > 32 || !isValidIpv4String(ip)) { return false; } return true; } catch (NumberFormatException e) { return false; } } return false; } }
IPUtils { public static final boolean isValidIpv4Subnet(String in) { String ip; String subnet; Matcher ipMatcher; if (in == null) { return false; } ipMatcher = subnetPattern.matcher(in); int subnetint; if (ipMatcher.find()) { ip = ipMatcher.group(1); subnet = ipMatcher.group(2); try { subnetint = Integer.parseInt(subnet); if (subnetint < 0 || subnetint > 32 || !isValidIpv4String(ip)) { return false; } return true; } catch (NumberFormatException e) { return false; } } return false; }  }
IPUtils { public static final boolean isValidIpv4Subnet(String in) { String ip; String subnet; Matcher ipMatcher; if (in == null) { return false; } ipMatcher = subnetPattern.matcher(in); int subnetint; if (ipMatcher.find()) { ip = ipMatcher.group(1); subnet = ipMatcher.group(2); try { subnetint = Integer.parseInt(subnet); if (subnetint < 0 || subnetint > 32 || !isValidIpv4String(ip)) { return false; } return true; } catch (NumberFormatException e) { return false; } } return false; }  static Integer rndInt(int lo, int hi); static Double rndDouble(double lo, double hi); static Integer rndPosInt(int lo, int hi); static String rndIp(); static Object rndChoice(List oList); static Object rndChoice(Object[] oArray); static String rndperc(); static final int ubyte2int(byte in); static final byte int2ubyte(int in); static boolean isValidIpv6String(String in); static final boolean isValidIpv4Subnet(String in); static boolean isValidIpv6Subnet(String in); static boolean isValidIpv4String(String in); static int nibble2int(byte nibble); static final byte int2nibble(int in); static String int16bit2hex(int i16); static int hex16bit2int(String in); static boolean IP4RegEx(String ip); static boolean IP6RegEx(String ip); static boolean IPRegEx(String ip); }
IPUtils { public static final boolean isValidIpv4Subnet(String in) { String ip; String subnet; Matcher ipMatcher; if (in == null) { return false; } ipMatcher = subnetPattern.matcher(in); int subnetint; if (ipMatcher.find()) { ip = ipMatcher.group(1); subnet = ipMatcher.group(2); try { subnetint = Integer.parseInt(subnet); if (subnetint < 0 || subnetint > 32 || !isValidIpv4String(ip)) { return false; } return true; } catch (NumberFormatException e) { return false; } } return false; }  static Integer rndInt(int lo, int hi); static Double rndDouble(double lo, double hi); static Integer rndPosInt(int lo, int hi); static String rndIp(); static Object rndChoice(List oList); static Object rndChoice(Object[] oArray); static String rndperc(); static final int ubyte2int(byte in); static final byte int2ubyte(int in); static boolean isValidIpv6String(String in); static final boolean isValidIpv4Subnet(String in); static boolean isValidIpv6Subnet(String in); static boolean isValidIpv4String(String in); static int nibble2int(byte nibble); static final byte int2nibble(int in); static String int16bit2hex(int i16); static int hex16bit2int(String in); static boolean IP4RegEx(String ip); static boolean IP6RegEx(String ip); static boolean IPRegEx(String ip);  }