URI ignores invalid ipv6 address while parsing authority
Chris Hegarty
chris.hegarty at oracle.com
Thu Mar 10 06:00:46 PST 2011
Alan, Michael,
Could you please take a look at the webrev below.
On 03/ 8/11 12:15 PM, Chris Hegarty wrote:
> 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.
Here is a webrev containing the implementation as described above, i.e.
appendAuthority correctly adds the given authority rather than just
ignoring it. parseHierarchical will throw URISyntaxException.
I've also updated the existing URI Test to include this case.
http://cr.openjdk.java.net/~chegar/7023363/webrev.oo/webrev/
-Chris.
>
> 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