United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7166896 DocumentBuilder.parse(String uri) is not IPv6 enabled. It throws MalformedURLException
JDK-7166896 : DocumentBuilder.parse(String uri) is not IPv6 enabled. It throws MalformedURLException

Details
Type:
Bug
Submit Date:
2012-05-07
Status:
Closed
Updated Date:
2013-04-20
Project Name:
JDK
Resolved Date:
2012-07-31
Component:
xml
OS:
generic
Sub-Component:
javax.xml.parsers
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u32
Fixed Versions:
7u40 (b01)

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Relates:
Relates:

Sub Tasks

Description
javax.xml.parsers.DocumentBuilder.parse() is not IPv6 enabled.
It throws a java.net.MalformedURLException: For input string: ":la03:73ff:fead:f7b0%5D"
        at java.net.URL.<init>(URL.java:601)
        at java.net.URL.<init>(URL.java:464)
        at java.net.URL.<init>(URL.java:413)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:650)
        at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:772)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)

                                    

Comments
WORK AROUND

The wor around is to download the Xerces2 Java 2.11.0 version from http://xerces.apache.org/mirrors.cgi
directly: http://mirror.uoregon.edu/apache//xerces/j/binaries/Xerces-J-bin.2.11.0.zip

Then unpack the stuff and put the library xercesImpl.jar in the directory $JAVA_HOME/jre/lib/endorsed as described in
http://docs.oracle.com/javase/6/docs/technotes/guides/standards/
                                     
2012-05-07
EVALUATION

DocumentBuilder.parse(String uri) relies on java.net.URL to read input, and it should limit itself so. The input (uri) should be a correctly encoded URI.

The hack of using escapeNonUSAscii should be removed. Note that, the same request to add the hack into Apache Xerces was extracted after it got adopted in the jdk.
                                     
2012-07-13
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-comp/jaxp/rev/7920ead2cc75
                                     
2012-08-14
Verified with attached testcase on Windows x64 and Linux x86
With jdk 7u14 b10
                                     
2013-01-30



Hardware and Software, Engineered to Work Together