You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Richard Rowell <ri...@bowmansystems.com> on 2002/09/24 23:55:26 UTC

Null pointer exceptions

I have written a java app that uses Xerces/Xalan to transform an XML
file through a series of XMLFilter(s).  It worked great till about ten
minutes ago when I started getting null pointer exceptions.  My XML code
hasn't changed a bit and either has the XML input file, so I'm at a loss
as to what is going on.  I'm using Xalan 2.4.0 as packaged in the
unstable tree of Debian (linux).

java.lang.RuntimeException: java.lang.NullPointerException
	at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3170)
	at
org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:433)
	at
org.apache.xerces.parsers.AbstractSAXParser.endDocument(AbstractSAXParser.java:715)
	at
org.apache.xerces.impl.XMLNamespaceBinder.endDocument(XMLNamespaceBinder.java:704)
	at
org.apache.xerces.impl.dtd.XMLDTDValidator.endDocument(XMLDTDValidator.java:985)
	at
org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(XMLDocumentScannerImpl.java:437)
	at
org.apache.xerces.impl.XMLEntityManager.endEntity(XMLEntityManager.java:1159)
	at
org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(XMLEntityManager.java:3204)
	at
org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipSpaces(XMLEntityManager.java:2905)
	at
org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(XMLDocumentScannerImpl.java:987)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
	at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:529)
	at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
	at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
	at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1148)
	at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
	at sax_mapper.parse_input(sax_mapper.java:58)
	at sax_mapper.parse_file(sax_mapper.java:75)
	at baisix.import_file(baisix.java:490)
	at baisix.main(baisix.java:71)



Re: Null pointer exceptions

Posted by Richard Rowell <ri...@bowmansystems.com>.
On Wed, 2002-09-25 at 12:48, Joseph Kesselman wrote:
> On Wednesday, 09/25/2002 at 09:02 EST, Richard Rowell 
> <ri...@bowmansystems.com> wrote:
> > Just an update.. It seems that the null pointer exception was in my
> > code, and for some reason java was reporting it as coming from Xalan.
> 
> Generally that sort of thing happens when you've got SAX code being driven 
> by Xalan's output, so its exception gets thrown back to/through Xalan. You 
> can get a bit more useful detail about what actually happened by 
> "unwrapping" the exception thrown by Xalan in turn; take a look at how we 
> implemented the -EDUMP switch in Process.java.

I took your advice and looked in Process.java.  I ripped out the
following bit. I have created a new NullPointer bug apparently, but
despite the copied code I'm still getting the NullPointer exception from
Xalan not my code.  Can anyone tell me what I'm doing wrong?

catch( Throwable throwable)
{
    while ( throwable instanceof
org.apache.xml.utils.WrappedRuntimeException)
    {
	throwable = ((org.apache.xml.utils.WrappedRuntimeException)
throwable).getException();
    }
           System.out.println( throwable.toString() );
           throwable.printStackTrace();
}


Re: Null pointer exceptions

Posted by Joseph Kesselman <ke...@us.ibm.com>.
On Wednesday, 09/25/2002 at 09:02 EST, Richard Rowell 
<ri...@bowmansystems.com> wrote:
> Just an update.. It seems that the null pointer exception was in my
> code, and for some reason java was reporting it as coming from Xalan.

Generally that sort of thing happens when you've got SAX code being driven 
by Xalan's output, so its exception gets thrown back to/through Xalan. You 
can get a bit more useful detail about what actually happened by 
"unwrapping" the exception thrown by Xalan in turn; take a look at how we 
implemented the -EDUMP switch in Process.java.

______________________________________
Joe Kesselman  / IBM Research

Re: Null pointer exceptions

Posted by Richard Rowell <ri...@bowmansystems.com>.
On Tue, 2002-09-24 at 16:55, Richard Rowell wrote:
> I have written a java app that uses Xerces/Xalan to transform an XML
> file through a series of XMLFilter(s).  It worked great till about ten
> minutes ago when I started getting null pointer exceptions.  My XML code
> hasn't changed a bit and either has the XML input file, so I'm at a loss
> as to what is going on.  I'm using Xalan 2.4.0 as packaged in the
> unstable tree of Debian (linux).
> 

Just an update.. It seems that the null pointer exception was in my
code, and for some reason java was reporting it as coming from Xalan. 
Very strange, but I am relieved that Xalan was not at fault.