Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-1628

NullPointerException in TransformerImpl.run() when reusing XMLFilter object

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.5Dx
    • None
    • SAX
    • Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
    • None
    • Operating System: Windows NT/2K
      Platform: PC
    • 22217

    Description

      Whenever I attempt to re-use an XMLFilter object, I receive the following stack
      trace (first use of the XMLFilter was successful, so it doesn't appear to be my
      XSL script):

      Exception in thread "main" java.lang.RuntimeException:
      java.lang.NullPointerException
      at
      org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3364)
      at
      org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:427)
      at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
      at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
      at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
      at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
      at
      org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown
      Source)
      at
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:191)
      at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:191)
      at transform.Transform.doTransform(Transform.java:298)
      at transform.Transform.doTransform(Transform.java:279)
      at transform.Transform.main(Transform.java:204)

      I traced this to the following line in TransformerImpl.applyTemplateToNode():

      DTM dtm = m_xcontext.getDTM(child);

      This appears to be returning null when the XMLFilter object is being used for
      the second time. If I comment out the:

      m_xcontext.reset();

      line in TransformerImpl.reset(), then the problem seems to be resolved, and I am
      able to re-use the same XMLFilter object many times.

      I have seem a few other items out on Google speaking of the same issue, and one
      poster stated he had this problem even with a simple modification to the
      UseXMLFilters sample to run the parse() in a loop; so this should be very easy
      to reproduce. If not, let me know, and I can pass on my code.

      Attachments

        Activity

          People

            Unassigned Unassigned
            chiaramg@us.ibm.com Gretchen Chiaramonte
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: