jmcnally 01/07/02 13:03:02
Modified: src/java/org/apache/turbine/services/velocity
TurbineVelocityService.java
Log:
important info about exceptions resulting from method calls to BO's is being
lost in turbine's general error reporting. It is better to unwrap the original
exception and report that.
Revision Changes Path
1.50 +11 -2
jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
Index: TurbineVelocityService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- TurbineVelocityService.java 2001/06/20 02:50:08 1.49
+++ TurbineVelocityService.java 2001/07/02 20:03:00 1.50
@@ -66,6 +66,7 @@
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.context.Context;
+import org.apache.velocity.exception.MethodInvocationException;
import org.apache.turbine.util.ContentURI;
import org.apache.turbine.util.RunData;
@@ -98,7 +99,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sean Legassick</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: TurbineVelocityService.java,v 1.49 2001/06/20 02:50:08 dlr Exp $
+ * @version $Id: TurbineVelocityService.java,v 1.50 2001/07/02 20:03:00 jmcnally
Exp $
*/
public class TurbineVelocityService
extends BaseTemplateEngineService
@@ -384,11 +385,19 @@
* @exception TurbineException Thrown every time. Adds additional
* information to <code>e</code>.
*/
- private final void renderingError(String filename, Exception e)
+ private final void renderingError(String filename, Throwable e)
throws TurbineException
{
String err = "Error rendering Velocity template: " + filename;
getCategory().error(err + ": " + e.getMessage());
+ // if the Exception is a MethodInvocationException, the underlying
+ // Exception is likely to be more informative, so rewrap that one.
+ if ( e instanceof MethodInvocationException )
+ {
+ e = ((MethodInvocationException)e).getWrappedThrowable();
+ }
+
+
throw new TurbineException(err, e);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]