sjsxp issue 18: NullPointerException thrown if DTD has no internal subset

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 7
    • Affects Version/s: 7
    • Component/s: xml
    • b14
    • generic
    • generic
    • Verified

        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.

              Assignee:
              Joe Wang
              Reporter:
              Joe Wang
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: