You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Sudarshan Purohit <su...@gmail.com> on 2013/05/31 11:14:08 UTC

VelocityException vs. MethodInvocationException

Hi,
   I'm trying to understand the exceptions thrown when there are errors in
parsing a Velocity Template. As per the documentation at
http://velocity.apache.org/engine/releases/velocity-1.5/apidocs/org/apache/velocity/exception/MethodInvocationException.html
,
whenever there's a reference error, i.e. undefined variables referenced,
the MethodInvocationException is thrown.
   I'm finding cases, however, when the VelocityException is thrown instead
for exactly that case. For example:

java.lang.RuntimeException:
org.apache.velocity.exception.VelocityException: Reference
$Order.DisplayInfo.AppNumber evaluated to null when attempting to render at
order.html

The AppNumber variable was undefined in this case.

Does anyone have pointers to which of the two exceptions is thrown? I need
this because I'm scanning the logs for the exception name and raising
alarms accordingly.

Thanks,
Sudarshan


-- 
-------------------------
Sudarshan Purohit
My Blog : http://connectionmachine.blogspot.com
-------------------------