You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/08/07 15:46:13 UTC

DO NOT REPLY [Bug 22217] New: - NullPointerException in TransformerImpl.run() when reusing XMLFilter object

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22217>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22217

NullPointerException in TransformerImpl.run() when reusing XMLFilter object

           Summary: NullPointerException in TransformerImpl.run() when
                    reusing XMLFilter object
           Product: XalanJ2
           Version: 2.5Dx
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: org.apache.xalan.transformer
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: chiaramg@us.ibm.com


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.