You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Pier Fumagalli <pi...@betaversion.org> on 2005/07/25 15:01:01 UTC

ExceptionSelector hack...

I got fed up with XALAN wrapping all sorts of exception in stupid  
RuntimeException, without declaring them as the init cause (see  
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java: 
3418) for an example).

So, I wrote a little patch that might (if very lucky) reconstruct the  
original exception from the message of a wrapped one by Xalan.

This happens when (for example) you have cinclude after xalan, if  
cinclude fails, xalan will throw a RuntimeException without wrapping  
the original ResourceNotFoundException, but simply including it in  
its name.

What this patch does is that if the exception being processed is a  
RuntimeException (not a subclass of), and the cause is null, it will  
try to recreate an exception instance from the detail message, and if  
successful, will declare that as the cause (thus allowing the  
ExceptionSelector to process almost correctly).

     Pier