if (result == null)
{
if (strictRef)
{
String name = jjtGetChild(i+1).getFirstToken().image;
throw new MethodInvocationException("Attempted to access '"
+ name + "' on a null value", null, name, uberInfo.getTemplateName(),
jjtGetChild(i+1).getLine(), jjtGetChild(i+1).getColumn());
}
String msg = "reference set is not a valid reference at "
+ Log.formatFileString(uberInfo);
log.error(msg);
return false;
}
}
/*
* We support two ways of setting the value in a #set($ref.foo = $value ) :
* 1) ref.setFoo( value )
* 2) ref,put("foo", value ) to parallel the get() map introspection
*/
try
{
VelPropertySet vs =
rsvc.getUberspect().getPropertySet(result, identifier,
value, uberInfo);
if (vs == null)
{
if (strictRef)
{
throw new MethodInvocationException("Object '" + result.getClass().getName() +
"' does not contain property '" + identifier + "'", null, identifier,
uberInfo.getTemplateName(), uberInfo.getLine(), uberInfo.getColumn());
}
else
{
return false;
}
}
vs.invoke(result, value);
}
catch(InvocationTargetException ite)
{
/*
* this is possible
*/
throw new MethodInvocationException(
"ASTReference : Invocation of method '"
+ identifier + "' in " + result.getClass()
+ " threw exception "
+ ite.getTargetException().toString(),
ite.getTargetException(), identifier, getTemplateName(), this.getLine(), this.getColumn());