@Test(expected = ParseException.class) public void testParse00() throws ParseException { IPv4Address.getAddress("0"); }
protected static short[] getAddress(String ipv4AddressString) throws ParseException { String[] addressParts = ipv4AddressString.split("[.]",-1); if (addressParts == null || addressParts.length != 4) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid address", 0); } short[] addressBytes = new short[4]; for (int i = 0 ; i < 4 ; i++) { try { int octet = Integer.parseInt(addressParts[i]); if (octet < 0 || octet > 255) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid octet: \"" + addressParts[i], 0); } else { addressBytes[i] = (short)octet; } } catch (NumberFormatException ex) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid octet: \"" + addressParts[i], 0); } } return addressBytes; }
IPv4Address extends IPAddress { protected static short[] getAddress(String ipv4AddressString) throws ParseException { String[] addressParts = ipv4AddressString.split("[.]",-1); if (addressParts == null || addressParts.length != 4) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid address", 0); } short[] addressBytes = new short[4]; for (int i = 0 ; i < 4 ; i++) { try { int octet = Integer.parseInt(addressParts[i]); if (octet < 0 || octet > 255) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid octet: \"" + addressParts[i], 0); } else { addressBytes[i] = (short)octet; } } catch (NumberFormatException ex) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid octet: \"" + addressParts[i], 0); } } return addressBytes; } }
IPv4Address extends IPAddress { protected static short[] getAddress(String ipv4AddressString) throws ParseException { String[] addressParts = ipv4AddressString.split("[.]",-1); if (addressParts == null || addressParts.length != 4) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid address", 0); } short[] addressBytes = new short[4]; for (int i = 0 ; i < 4 ; i++) { try { int octet = Integer.parseInt(addressParts[i]); if (octet < 0 || octet > 255) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid octet: \"" + addressParts[i], 0); } else { addressBytes[i] = (short)octet; } } catch (NumberFormatException ex) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid octet: \"" + addressParts[i], 0); } } return addressBytes; } IPv4Address(short[] addressBytesIn, short[] addressMaskIn, PortRange portRangeIn); }
IPv4Address extends IPAddress { protected static short[] getAddress(String ipv4AddressString) throws ParseException { String[] addressParts = ipv4AddressString.split("[.]",-1); if (addressParts == null || addressParts.length != 4) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid address", 0); } short[] addressBytes = new short[4]; for (int i = 0 ; i < 4 ; i++) { try { int octet = Integer.parseInt(addressParts[i]); if (octet < 0 || octet > 255) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid octet: \"" + addressParts[i], 0); } else { addressBytes[i] = (short)octet; } } catch (NumberFormatException ex) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid octet: \"" + addressParts[i], 0); } } return addressBytes; } IPv4Address(short[] addressBytesIn, short[] addressMaskIn, PortRange portRangeIn); static String formatAddress(short[] addressBytes); static IPv4Address newIPv4Instance(String ipv4AddressString); static boolean isIPv4Address(String ipv4AddressString); @Override String stringValue(); @Override String toString(); @Override boolean equals(Object obj); }
IPv4Address extends IPAddress { protected static short[] getAddress(String ipv4AddressString) throws ParseException { String[] addressParts = ipv4AddressString.split("[.]",-1); if (addressParts == null || addressParts.length != 4) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid address", 0); } short[] addressBytes = new short[4]; for (int i = 0 ; i < 4 ; i++) { try { int octet = Integer.parseInt(addressParts[i]); if (octet < 0 || octet > 255) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid octet: \"" + addressParts[i], 0); } else { addressBytes[i] = (short)octet; } } catch (NumberFormatException ex) { throw new ParseException(INVALID_IP4ADDRESS_MSG + ipv4AddressString + "\": invalid octet: \"" + addressParts[i], 0); } } return addressBytes; } IPv4Address(short[] addressBytesIn, short[] addressMaskIn, PortRange portRangeIn); static String formatAddress(short[] addressBytes); static IPv4Address newIPv4Instance(String ipv4AddressString); static boolean isIPv4Address(String ipv4AddressString); @Override String stringValue(); @Override String toString(); @Override boolean equals(Object obj);  }