cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pier Fumagalli <p...@betaversion.org>
Subject ExceptionSelector hack...
Date Mon, 25 Jul 2005 13:01:01 GMT
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


Mime
View raw message