8028074: InetAddress.getByName fails with UHE "invalid IPv6 address" if host name starts with a-f

Reviewed-by: chegar
This commit is contained in:
Alan Bateman 2013-11-08 21:07:42 +00:00
parent 61b2527b10
commit 086dfc45ca

View File

@ -1144,7 +1144,7 @@ class InetAddress implements java.io.Serializable {
ifname = host.substring (pos+1);
}
}
if ((addr = IPAddressUtil.textToNumericFormatV6(host)) == null) {
if ((addr = IPAddressUtil.textToNumericFormatV6(host)) == null && host.contains(":")) {
throw new UnknownHostException(host + ": invalid IPv6 address");
}
} else if (ipv6Expected) {