JDK-7166896 : DocumentBuilder.parse(String uri) is not IPv6 enabled. It throws MalformedURLException
  • Type: Bug
  • Component: xml
  • Sub-Component: javax.xml.parsers
  • Affected Version: 6u32
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-05-07
  • Updated: 2013-09-12
  • Resolved: 2012-07-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
6u35Fixed 7u40 b01Fixed 8Fixed
Related Reports
Relates :  
Relates :  
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)

Verified with attached testcase on Windows x64 and Linux x86 With jdk 7u14 b10

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/jaxp/rev/7920ead2cc75

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.

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/