public Object exec(List arguments) throws TemplateModelException {
try
{
return wrapper.invokeMethod(object, (Method)getMember(),
unwrapArguments(arguments, wrapper));
}
catch(Exception e)
{
while(e instanceof InvocationTargetException)
{
Throwable t = ((InvocationTargetException)e).getTargetException();
if(t instanceof Exception)
{
e = (Exception)t;
}
else
{
break;
}
}
if((getMember().getModifiers() & Modifier.STATIC) != 0)
{
throw new TemplateModelException("Method " + getMember() +
" threw an exception", e);
}
else
{
throw new TemplateModelException("Method " + getMember() +
" threw an exception when invoked on " + object, e);
}
}
}
Invokes the method, passing it the arguments from the list. |