cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <>
Subject Re: Catching a NullPointerException to display custom error page
Date Wed, 10 May 2006 13:26:46 GMT
Aron Shamash wrote:
> Yes Reijn
> I am using the ExceptionSelector already for catching "page not found"
> and "invalid continuation" exceptions :
> 				<exception
> class="org.apache.cocoon.ResourceNotFoundException" name="not-found"/>
> 				<exception
> class="org.apache.cocoon.components.flow.InvalidContinuationException"
> name="invalid-continuation"/> 
> I noticed further down the errorhandling page you cite, there is mention
> of null pointer excpetions :
> "A NullPointerException occurs, because something went completely wrong
> in the application: All handlers are not configured for such an
> exception and so the root sitemaps default handler will apply to it
> showing a general error page."
> Does this mean it is not possible to configure handlers for this type of
> exception and therefore not possible display a customer error page?
> The Background
> -----------------------
> The reason for this query is that I am passing a query string parameter
> to a page which pulls in content from an xml file.
> For example : This displays a popup
> using content stored in a file called 11.xml. If the following is typed
> into the browser : there is no xml
> content to display because the is no foo.xml file and thus a
> NullPointerException is thrown.  I would like a "nice" error page to be
> display in this instance.

I would suggest that NullPointerException is not appropriate for this;
ResourceNotFoundException would be much more appropriate.  Why are you
letting an NPE through rather than checking for null and throwing a more
 descriptive exception type?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message