private static void validateIPAddress ( String ipAddress ) { try { @ SuppressWarnings ( "unused" ) Inet4Address address = ( Inet4Address ) Inet4Address . getByName ( ipAddress ) ; } catch ( Exception ex ) { throw new IllegalArgumentException ( String . format ( SR . INVALID_IP_ADDRESS , ipAddress ) , ex ) ; } }
Validate that the IP address is IPv4 .