Reinhard Pötz wrote:
Robin Wyles wrote:
Hi,
I have a component in my app that uses SourceResolver to create a
ServletSource. When I call this component from within a pipeline, e.g.
from flow or from a sitemap component all works well. However, when I
call this method from a cron job I get the following NPE:
java.lang.NullPointerException
at
org.apache.cocoon.callstack.environment.CallFrameHelper.getContext(CallFrameHelper.java:75)
at
org.apache.cocoon.servletservice.CallStackHelper.getCurrentServletContext(CallStackHelper.java:112)
at
org.apache.cocoon.servletservice.components.ServletSource.createServletConnection(ServletSource.java:125)
<snip/>
The root problem seems to be that the CallStack is empty and so the
the current ServletContext cannot be obtained using
CallStackHelper.getCurrentServletContext().
Am I doing anything wrong?
IMO no. From a quick glance at the code I think it needs to be more
defensive in terms of catching NPEs. In the case that there is no
existing call frame, null should be returned. Grzegorz, what do you think?
I've just committed a fix for this (revision 682356) so that *absolute*
servlet URLs *should* work. (It can never work for self-referenced
servlet URLs or relative servlet URLs without an existing servlet
service request.)
Unfortunately I don't have a test case and currently no idea how I can
provide a simple environment. This means that I'm not sure if there are
other locations that have a problem if there is no existing servlet
service requuest.
Any ideas for a test environment?
--
Reinhard Pötz Managing Director, {Indoqa} GmbH
http://www.indoqa.com/en/people/reinhard.poetz/
Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member [EMAIL PROTECTED]
________________________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]