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?

--
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]

Reply via email to