-
Bug
-
Resolution: Fixed
-
P3
-
7u2
-
b15
-
x86
-
windows_7
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2225428 | 8 | Joe Wang | P3 | Closed | Fixed | b45 |
JDK-8023370 | 6u71 | Mala Bankal | P3 | Resolved | Fixed | b01 |
JDK-8023372 | 6u65 | Mala Bankal | P3 | Closed | Fixed | b08 |
The problem is found in JAXP RI 1.4.5.
If setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) is set on SAXParserFactory object, XMLReader object or DocumentBuilderFactory object, NullPointerException will be thrown when parsing XML document that has DOCTYPE declaration.
The steps of using the attached test program to reproduce:
1. unzip 001.zip
2. cd TP folder
3. launch go.bat
4. The file result.txt shows NullPointerException
The test program expects org.xml.sax.SAXParseException as follows.
-----
SAXParserFactory: OK
XMLReader: OK
DocumentBuilderFactory: OK
-----
If it is executed on JAXP RI 1.4.5, however, the following NullPointerException will be thrown.
-----
SAXParserFactory: NG illegal message text
java.lang.NullPointerException
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDProcessor.startDTD(XMLDTDProcessor.java:677)
:
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:341)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:277)
at parse.set_SAXParserFactory(parse.java:33)
at parse.main(parse.java:16)
XMLReader: NG illegal message text
java.lang.NullPointerException
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDProcessor.startDTD(XMLDTDProcessor.java:677)
:
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1176)
at parse.set_XMLReader(parse.java:53)
at parse.main(parse.java:17)
DocumentBuilderFactory: NG illegal message text
java.lang.NullPointerException
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDProcessor.startDTD(XMLDTDProcessor.java:677)
:
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
at parse.set_DocumentBuilderFactory(parse.java:74)
at parse.main(parse.java:18)
-----
The diff for the fix is under src folder.
If setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) is set on SAXParserFactory object, XMLReader object or DocumentBuilderFactory object, NullPointerException will be thrown when parsing XML document that has DOCTYPE declaration.
The steps of using the attached test program to reproduce:
1. unzip 001.zip
2. cd TP folder
3. launch go.bat
4. The file result.txt shows NullPointerException
The test program expects org.xml.sax.SAXParseException as follows.
-----
SAXParserFactory: OK
XMLReader: OK
DocumentBuilderFactory: OK
-----
If it is executed on JAXP RI 1.4.5, however, the following NullPointerException will be thrown.
-----
SAXParserFactory: NG illegal message text
java.lang.NullPointerException
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDProcessor.startDTD(XMLDTDProcessor.java:677)
:
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:341)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:277)
at parse.set_SAXParserFactory(parse.java:33)
at parse.main(parse.java:16)
XMLReader: NG illegal message text
java.lang.NullPointerException
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDProcessor.startDTD(XMLDTDProcessor.java:677)
:
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1176)
at parse.set_XMLReader(parse.java:53)
at parse.main(parse.java:17)
DocumentBuilderFactory: NG illegal message text
java.lang.NullPointerException
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDProcessor.startDTD(XMLDTDProcessor.java:677)
:
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
at parse.set_DocumentBuilderFactory(parse.java:74)
at parse.main(parse.java:18)
-----
The diff for the fix is under src folder.
- backported by
-
JDK-8023370 NullPointerException occurs when parsing XML doc
-
- Resolved
-
-
JDK-2225428 NullPointerException occurs when parsing XML doc
-
- Closed
-
-
JDK-8023372 NullPointerException occurs when parsing XML doc
-
- Closed
-
- relates to
-
JDK-6509774 SJSXP issue 9: Can't parse document with doctype declaration without retrieving DTD
-
- Closed
-