Closed spring-projects-issues closed 12 years ago
Juergen Hoeller commented
Thanks for the suggestion! I've adapted VelocityView to translate a Velocity MethodInvocationException into a Spring NestedServletException, properly keeping the original exception thrown by the invoked method (through Spring's checked exception strategy, overriding the JDK 1.4 getCause method - compatible with both JDK 1.3 and 1.4+).
Juergen
Noa Resare opened SPR-1448 and commented
velocity templates has the ability to call methods when rendered. Sometimes the results of such method invocations is an exception. These exceptions are propagated as org.apache.velocity.exception.MethodInvocationException instances through the call stack. There are two problems with the current out of the box behaviour:
1) Velocity aims to be jvm1.3 compatible, so the generic exception nesting mechanism in java1.4 is not used for the causing exception. Instead the method getWrappedThrowable() is used. This effectively makes the causing exception disappear from the stack trace in most cases.
2) The name of the View that was executing when the exception was thrown is not shown.
To solve this problem I have subclassed the VelocityView, adding this method that handles these two problems:
It hink it would be a valuable improvement if this functionality was incorporated in for example VelocityView.doRender()
Thanks for a great product. After being stuck in ejb hell for too long, spring feels like heaven :)
Affects: 1.2.5