-
Bug
-
Resolution: Fixed
-
P4
-
7
-
b14
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2181787 | 6u18 | Joe Wang | P4 | Resolved | Fixed | b02 |
The following unit test:
public void testDTDWithNoInternalSubset() throws Exception
{
String xml = "<!DOCTYPE name><a><b/></a>";
//String xml = "<!DOCTYPE name []><a><b/></a>"; //(this works)
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader r = factory.createXMLStreamReader( new StringReader(
xml ) );
r.next(); // NullPointerException thrown
r.require( XMLStreamReader.DTD, null, null );
}
Produces the following stack trace:
java.lang.NullPointerException
at com.sun.xml.stream.XMLDocumentScannerImpl$PrologDriver.next
(XMLDocumentScannerImpl.java:965)
at com.sun.xml.stream.XMLDocumentScannerImpl.next
(XMLDocumentScannerImpl.java:353)
at com.sun.xml.stream.XMLReaderImpl.next(XMLReaderImpl.java:557)
The XML specification permits a DTD to neither point to an external subset nor
contain an internal subset:
'<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'
Therefore <!DOCTYPE name> should be allowed.------- Additional comments from spericas Wed Feb 28 20:26:01 +0000 2007 -------
Looks like an issue in the scanner that needs investigation.------- Additional comments from spericas Fri Mar 2 15:17:23 +0000 2007 -------
Problem is fixed and it wasn't in the scanner. It was just simple unguarded
method call whose object reference was null in this case.
public void testDTDWithNoInternalSubset() throws Exception
{
String xml = "<!DOCTYPE name><a><b/></a>";
//String xml = "<!DOCTYPE name []><a><b/></a>"; //(this works)
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader r = factory.createXMLStreamReader( new StringReader(
xml ) );
r.next(); // NullPointerException thrown
r.require( XMLStreamReader.DTD, null, null );
}
Produces the following stack trace:
java.lang.NullPointerException
at com.sun.xml.stream.XMLDocumentScannerImpl$PrologDriver.next
(XMLDocumentScannerImpl.java:965)
at com.sun.xml.stream.XMLDocumentScannerImpl.next
(XMLDocumentScannerImpl.java:353)
at com.sun.xml.stream.XMLReaderImpl.next(XMLReaderImpl.java:557)
The XML specification permits a DTD to neither point to an external subset nor
contain an internal subset:
'<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'
Therefore <!DOCTYPE name> should be allowed.------- Additional comments from spericas Wed Feb 28 20:26:01 +0000 2007 -------
Looks like an issue in the scanner that needs investigation.------- Additional comments from spericas Fri Mar 2 15:17:23 +0000 2007 -------
Problem is fixed and it wasn't in the scanner. It was just simple unguarded
method call whose object reference was null in this case.
- backported by
-
JDK-2181787 sjsxp issue 18: NullPointerException thrown if DTD has no internal subset
-
- Resolved
-