8028074: InetAddress.getByName fails with UnknownHostException: invalid IPv6 address if host name starts with a-f
Michael McMahon
michael.x.mcmahon at oracle.com
Fri Nov 8 13:09:34 PST 2013
Ah, I noticed this today. Thanks for fixing it so quickly.
Michael
On 08/11/13 20:43, Chris Hegarty wrote:
> The change looks good to me.
>
> Thanks for spotting this and jumping on it so quickly.
>
> -Chris.
>
> On 08/11/2013 20:39, Alan Bateman wrote:
>>
>> There's a small problem with the fix for JDK- 8019834 that was pushed to
>> jdk8/tl today. The patch means that UHE is thrown when doing a lookup of
>> hosts that start with a-f. I ran into it because I happen to be on a
>> machine that starts with "a" :-)
>>
>> I'd like to get a patch into jdk8/tl quickly so that others don't run
>> into this. The proposed patch is attached.
>>
>> -Alan
>>
>> diff --git a/src/share/classes/java/net/InetAddress.java
>> b/src/share/classes/java/net/InetAddress.java
>> --- a/src/share/classes/java/net/InetAddress.java
>> +++ b/src/share/classes/java/net/InetAddress.java
>> @@ -1144,7 +1144,7 @@
>> 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) {
>>
More information about the net-dev
mailing list