You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jan <vi...@gmx.de> on 2002/02/11 18:28:54 UTC

[C2] Right behavior regarding a SAXException in a Transformer

Hello!

When a Transformer catches a SAXException and it rethrows it (or let's say it is produced during an invocation of a SAX related function in the Transformers XMLConsumer and is not explicitely catched) then the Generator get's a SAXException.. This leads to a log entry like:

org.apache.cocoon.ProcessingException: Could not read resource file:/foo.xml: java.util.NoSuchElementException

This is actually misleading for the problem was not to read the resource. Furthermore the Transformer is not in the stack trace of the original message (see below) - nor of the ProcessingException what I do not understand. It is responsible for the exception. I have tried to comment it out and to replace it with another transformer and had no exception then. The browser get's no feedback it seems and keeps "loading" until timeout.

How should I handle such an exception to avoid this?

Cheers,
Jan

____________
 
java.util.NoSuchElementException
 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1111)
 at org.apache.cocoon.components.parser.JaxpParser.parse(JaxpParser.java:182)
 at org.apache.cocoon.components.source.URLSource.toSAX(URLSource.java:331)
 at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:109)
 at org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEventPipeline.java:209)
 at org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingStreamPipeline.java:355)
 at org.apache.cocoon.www.sitemap_xmap.matchN1022C(sitemap_xmap.java:1738)
 at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1515)
 at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1421)
 at org.apache.cocoon.sitemap.Handler.process(Handler.java:180)
 at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:127)
 at org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:144)
 at org.apache.cocoon.Cocoon.process(Cocoon.java:582)
 at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:795)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:500)
 at org.apache.tomcat.core.Handler.service(Handler.java:223)
 at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:448)
 at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:788)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:701)
 at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:143)
 at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:424)
 at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:497)
 at java.lang.Thread.run(Thread.java:484)

Re: [C2] Right behavior regarding a SAXException in a Transformer

Posted by Jan <vi...@gmx.de>.
Hi,

Umm... in browser I get a more useful stack trace it seems as there appears
my Transformer.

_________ Log message stack trace: ____________

DEBUG   (2002-02-12) 13:04.27:996   [sitemap.generator.file]
(/mux/docs/welcome.xml) Thread-37/FileGenerator: Got SAXException;
Rethrowing cause exception
java.lang.ArrayIndexOutOfBoundsException
 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1111)
 at
org.apache.cocoon.components.parser.JaxpParser.parse(JaxpParser.java:182)
 at org.apache.cocoon.components.source.URLSource.toSAX(URLSource.java:331)
 at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:109)
 at
org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEv
entPipeline.java:209)
 at
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingS
treamPipeline.java:355)
 at org.apache.cocoon.www.sitemap_xmap.matchN1022C(sitemap_xmap.java:1738)
 at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1515)
 at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1421)
 at org.apache.cocoon.sitemap.Handler.process(Handler.java:180)
 at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:127)
 at
org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:144)
 at org.apache.cocoon.Cocoon.process(Cocoon.java:582)
 at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:795)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at
org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:500)
 at org.apache.tomcat.core.Handler.service(Handler.java:223)
 at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:448)
 at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:78
8)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:701)
 at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10I
nterceptor.java:143)
 at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:424)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:497)
 at java.lang.Thread.run(Thread.java:484)

_________ Processing exception in browser: _____________

Original exception : java.lang.ArrayIndexOutOfBoundsException
at org.apache.xml.utils.BoolStack.pop(BoolStack.java:134)
at
org.apache.xalan.serialize.SerializerToXML.endElement(SerializerToXML.java:1
069)
at
org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerI
dentityImpl.java:1047)
at
org.apache.cocoon.xml.AbstractXMLPipe.endElement(AbstractXMLPipe.java:105)
at
org.apache.cocoon.serialization.AbstractTextSerializer$NamespaceAsAttributes
.endElement(AbstractTextSerializer.java:437)
at
org.apache.cocoon.xml.AbstractXMLPipe.endElement(AbstractXMLPipe.java:105)
at
org.apache.cocoon.xml.AbstractXMLPipe.endElement(AbstractXMLPipe.java:105)
at
de.mux.transformation.TemplateTransformer.endElement(TemplateTransformer.jav
a:282)
at
org.apache.cocoon.components.sax.XMLTeePipe.endElement(XMLTeePipe.java:81)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator
.java:1550)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
LDocumentScanner.java:1204)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.apache.cocoon.components.parser.JaxpParser.parse(JaxpParser.java:182)
at org.apache.cocoon.components.source.URLSource.toSAX(URLSource.java:331)
at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:109)
at
org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEv
entPipeline.java:209)
at
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingS
treamPipeline.java:355)
at org.apache.cocoon.www.sitemap_xmap.matchN1022C(sitemap_xmap.java:1738)
at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1515)
at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1421)
at org.apache.cocoon.sitemap.Handler.process(Handler.java:180)
at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:127)
at org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:144)
at org.apache.cocoon.Cocoon.process(Cocoon.java:582)
at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:795)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at
org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:500)
at org.apache.tomcat.core.Handler.service(Handler.java:223)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:448)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:78
8)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:701)
at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10I
nterceptor.java:143)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:424)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:497)
at java.lang.Thread.run(Thread.java:484)


----- Original Message -----
From: "Jan" <vi...@gmx.de>
To: <co...@xml.apache.org>
Sent: Tuesday, February 12, 2002 1:12 PM
Subject: Re: [C2] Right behavior regarding a SAXException in a Transformer


> Hi Vadim,
>
> Tested it and I think this works fine. Actually I cannot rebuild the old
> exception for I have changed much by now but it should be quite similar.
> Your message is now in the logs ... in the browser I still get the old
style
> error (with another cause exception):
>
> org.apache.cocoon.ProcessingException: Could not read resource
> file:/foobar.xml: java.lang.ArrayIndexOutOfBoundsException
>
> The reason now is a bug in my Transformer that returns an ending tag but
> previously has skiped the starting tag.. it seems this leads to an
> ArrayIndexOutOfBoundsException.
>
> Cheers,
> Jan
>
> ----- Original Message -----
> From: "Vadim Gritsenko" <va...@verizon.net>
> To: <co...@xml.apache.org>
> Sent: Monday, February 11, 2002 7:23 PM
> Subject: RE: [C2] Right behavior regarding a SAXException in a Transformer
>
>
> Hi,
>
> Try attached patch (patched FileGenerator also included if you do not
> have patch command) and send in back your results with this patch.
>
> PS Next time use plain text email.
>
> Regards,
> Vadim


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: [C2] Right behavior regarding a SAXException in a Transformer

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Jan [mailto:vincev@gmx.de]
> 
> Hi Vadim,
> 
> Tested it and I think this works fine. Actually I cannot rebuild the
old
> exception for I have changed much by now but it should be quite
similar.
> Your message is now in the logs ... in the browser I still get the old
style
> error (with another cause exception):
> 
> org.apache.cocoon.ProcessingException: Could not read resource
> file:/foobar.xml: java.lang.ArrayIndexOutOfBoundsException
> 
> The reason now is a bug in my Transformer that returns an ending tag
but
> previously has skiped the starting tag.. it seems this leads to an
> ArrayIndexOutOfBoundsException.

FYI: SAXException returns message of the cause exception but prints only
own stacktrace, which is misleading. Hence the patch.

Vadim

> 
> Cheers,
> Jan
> 
> ----- Original Message -----
> From: "Vadim Gritsenko" <va...@verizon.net>
> To: <co...@xml.apache.org>
> Sent: Monday, February 11, 2002 7:23 PM
> Subject: RE: [C2] Right behavior regarding a SAXException in a
Transformer
> 
> 
> Hi,
> 
> Try attached patch (patched FileGenerator also included if you do not
> have patch command) and send in back your results with this patch.
> 
> PS Next time use plain text email.
> 
> Regards,
> Vadim


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: [C2] Right behavior regarding a SAXException in a Transformer

Posted by Jan <vi...@gmx.de>.
Hi Vadim,

Tested it and I think this works fine. Actually I cannot rebuild the old
exception for I have changed much by now but it should be quite similar.
Your message is now in the logs ... in the browser I still get the old style
error (with another cause exception):

org.apache.cocoon.ProcessingException: Could not read resource
file:/foobar.xml: java.lang.ArrayIndexOutOfBoundsException

The reason now is a bug in my Transformer that returns an ending tag but
previously has skiped the starting tag.. it seems this leads to an
ArrayIndexOutOfBoundsException.

Cheers,
Jan

----- Original Message -----
From: "Vadim Gritsenko" <va...@verizon.net>
To: <co...@xml.apache.org>
Sent: Monday, February 11, 2002 7:23 PM
Subject: RE: [C2] Right behavior regarding a SAXException in a Transformer


Hi,

Try attached patch (patched FileGenerator also included if you do not
have patch command) and send in back your results with this patch.

PS Next time use plain text email.

Regards,
Vadim


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: [C2] Right behavior regarding a SAXException in a Transformer

Posted by Vadim Gritsenko <va...@verizon.net>.
Hi,

Try attached patch (patched FileGenerator also included if you do not
have patch command) and send in back your results with this patch.

PS Next time use plain text email.

Regards,
Vadim

-----Original Message-----
From: Jan [mailto:vincev@gmx.de] 
Sent: Monday, February 11, 2002 12:29 PM
To: cocoon-users@xml.apache.org
Subject: [C2] Right behavior regarding a SAXException in a Transformer

Hello!
 
When a Transformer catches a SAXException and it rethrows it (or let's
say it is produced during an invocation of a SAX related function in the
Transformers XMLConsumer and is not explicitely catched) then the
Generator get's a SAXException.. This leads to a log entry like:
 
org.apache.cocoon.ProcessingException: Could not read resource
file:/foo.xml: java.util.NoSuchElementException
 
This is actually misleading for the problem was not to read the
resource. Furthermore the Transformer is not in the stack trace of the
original message (see below) - nor of the ProcessingException what I do
not understand. It is responsible for the exception. I have tried to
comment it out and to replace it with another transformer and had no
exception then. The browser get's no feedback it seems and keeps
"loading" until timeout.
 
How should I handle such an exception to avoid this?
 
Cheers,
Jan
 
____________
 
java.util.NoSuchElementException
 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1111)
 at
org.apache.cocoon.components.parser.JaxpParser.parse(JaxpParser.java:182
)
 at
org.apache.cocoon.components.source.URLSource.toSAX(URLSource.java:331)
 at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:1
09)
 at
org.apache.cocoon.components.pipeline.CachingEventPipeline.process(Cachi
ngEventPipeline.java:209)
 at
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(Cach
ingStreamPipeline.java:355)
 at
org.apache.cocoon.www.sitemap_xmap.matchN1022C(sitemap_xmap.java:1738)
 at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1515)
 at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1421)
 at org.apache.cocoon.sitemap.Handler.process(Handler.java:180)