URI ignores invalid ipv6 address while parsing authority

Chris Hegarty chris.hegarty at oracle.com
Tue Mar 8 04:15:06 PST 2011


On 03/ 8/11 09:21 AM, Jing LV wrote:
> ....
> (I am not sure but it seems the mail was not sent successfully - sorry if you receive it twice!)
> Thanks Chris. I see the bug 7023363 online. I wonder is there a fix now?
> I find that we may add an else block at the end of the
> URI.appendAuthority() to throw the right exception:
> 
>                       sb.append(quote(doquote,
>                               L_REG_NAME | L_SERVER,
>                               H_REG_NAME | H_SERVER));
> +                } else {
> +                    // there is no valid address in "[]"
> +                    throw new URISyntaxException(authority,
> +                            "Malformed IPv6 address.");
>                   }
>               } else {
>                   sb.append(quote(authority,

The URI implementation first tries to build an internal string
representation of the given components, then parses this string to
determine if it is valid. I think we should change appendAuthority to
treat [www.abc.com] as a regular authority and this would then be caught
in parseHierarchical and URISyntaxException thrown.

Let me try this approach and I'll get back to you.

-Chris.

> 
> 
> Any ideas?
> 
> 
> 
> 
>> -Chris.
>>
>>> Any comments?
>>>
> 
> 



More information about the net-dev mailing list