cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <alexander.klimetsc...@mindquarry.com>
Subject Re: [2.2] NPE when using block: protocol, caused by a ResourceNotFoundException
Date Thu, 21 Dec 2006 17:43:12 GMT
Hi Bart,

I had the same problem and fixed it with a patch:

https://issues.apache.org/jira/browse/COCOON-1954

Unfortunately it is not committed yet, because it was unclear if this 
might break some specific old problem.

The problem is that the original exception is swallowed, so the "called" 
block tries to write the error page into the blockconnection stream, 
which is not possible due to a difficult (and currently wrong) 
implementation of BlockCallHttpServletResponse.reset(). But this is no 
problem, since the caller (the calling block) cannot handle the error 
page anyway, it might be expecting xml anyway. So the exception should 
be passed on so that it is catched in the exception handler of the 
calling block - which then can write the error page into the response to 
the browser.

Alex

Bart Molenkamp schrieb:
> Hi,
> 
> While using the block: protocol, I got NullPointerExceptions because a
> resource could not be found in the target block. This was due to a
> ResourceNotFoundException, and when Cocoon tries to report the
> exception, the NPE occurs.
> 
> It seems that the outputStream member is null. Has anybody any idea
> where this should be set? The exception is quite confusing, because I
> can't see the original ResourceNotFoundException.
> 
> Here is the stacktrace:
> 
> java.lang.NullPointerException
> 	at
> org.apache.cocoon.blocks.util.BlockCallHttpServletResponse$1.write(Block
> CallHttpServletResponse.java:158)
> 	at java.io.OutputStream.write(OutputStream.java:99)
> 	at java.io.OutputStream.write(OutputStream.java:58)
> 	at
> org.apache.cocoon.components.notification.Notifier.notifyHTML(Notifier.j
> ava:104)
> 	at
> org.apache.cocoon.components.notification.Notifier.notify(Notifier.java:
> 49)
> 	at
> org.apache.cocoon.servlet.RequestProcessor.manageException(RequestProces
> sor.java:306)
> 	at
> org.apache.cocoon.servlet.RequestProcessor.service(RequestProcessor.java
> :176)
> 	at
> org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:61)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> 	at
> org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContex
> t.java:461)
> 	at
> org.apache.cocoon.blocks.BlockContext$NamedDispatcher.forward(BlockConte
> xt.java:404)
> 	at
> org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.
> java:115)
> 	at
> org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSour
> ce.java:51)
> 	at
> org.apache.cocoon.reading.ResourceReader.generate(ResourceReader.java:32
> 7)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at
> org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$Proxy
> Handler.invoke(PoolableFactoryBean.java:349)
> 	at $Proxy4.generate(Unknown Source)
> 	at
> org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipe
> line.processReader(AbstractCachingProcessingPipeline.java:878)
> 	at
> org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process
> (AbstractProcessingPipeline.java:429)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at
> org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$Proxy
> Handler.invoke(PoolableFactoryBean.java:349)
> 	at $Proxy3.process(Unknown Source)
> 	at
> org.apache.cocoon.components.treeprocessor.sitemap.ReadNode.invoke(ReadN
> ode.java:94)
> 	at
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
> invokeNodes(AbstractParentProcessingNode.java:55)
> 	at
> org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(Matc
> hNode.java:87)
> 	at
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
> invokeNodes(AbstractParentProcessingNode.java:77)
> 	at
> org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P
> ipelineNode.java:152)
> 	at
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
> invokeNodes(AbstractParentProcessingNode.java:77)
> 	at
> org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(
> PipelinesNode.java:93)
> 	at
> org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
> (ConcreteTreeProcessor.java:239)
> 	at
> org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
> (ConcreteTreeProcessor.java:170)
> 	at
> org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro
> cessor.java:233)
> 	at
> org.apache.cocoon.servlet.RequestProcessor.process(RequestProcessor.java
> :377)
> 	at
> org.apache.cocoon.servlet.RequestProcessor.service(RequestProcessor.java
> :155)
> 	at
> org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:61)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> 	at
> org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContex
> t.java:461)
> 	at
> org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContex
> t.java:443)
> 	at
> org.apache.cocoon.blocks.BlockServlet.service(BlockServlet.java:123)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> 	at
> org.apache.cocoon.blocks.DispatcherServlet.service(DispatcherServlet.jav
> a:128)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> 	at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
> 	at
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationH
> andler.java:473)
> 	at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
> 	at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
> 	at
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationCon
> text.java:633)
> 	at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> 	at org.mortbay.http.HttpServer.service(HttpServer.java:909)
> 	at
> org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
> 	at
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
> 	at
> org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
> 	at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245
> )
> 	at
> org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
> 	at
> org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> 
> Thanks,
> Bart.
> 
> 


-- 
Alexander Klimetschek
http://www.mindquarry.com


Mime
View raw message