RFR [7u6]: 7166896: DocumentBuilder.parse(String uri) is not IPv6 enabled. It throws MalformedURLException

Joe Wang huizhe.wang at oracle.com
Fri Jun 22 23:09:40 UTC 2012


Hi,

This is a patch to fix the IPv6 issue.

In a previous patch to fix an issue with system id containing 
international characters, an extra character escaping was added so that 
any URL passed to the parser goes through method escapeNonUSAscii before 
it's used to construct an URL.

However, literal IPv6 addresses are enclosed in square brackets. The 
escapeNonUSAscii encoded address will become unrecognizable to URL that 
would throw a java.net.MalformedURLException.  An address such as 
http://[fe80::la03:73ff:fead:f7b0]/note.xml is encoded as 
http://%5Bfe80::la03:73ff:fead:f7b0%5D/note.xml", resulting in 
java.net.MalformedURLException: For input string: ":la03:73ff:fead:f7b0%5D".

This patch skips the encoding process and returns it as is if there're 
no non-ascii characters.

webrev: http://cr.openjdk.java.net/~joehw/7u6/7166896/webrev/

Please review.

Thanks,
Joe



More information about the core-libs-dev mailing list