in core/src/main/java/org/apache/commons/jelly/tags/core/InvokeStaticTag.java [115:157]
public void doTag(XMLOutput output) throws JellyTagException {
try {
if ( null == methodName) {
throw new MissingAttributeException( "method" );
}
invokeBody(output);
Object[] values = paramValues.toArray();
Class[] types = (Class[])(paramTypes.toArray(new Class[paramTypes.size()]));
Method method = loadClass().getMethod( methodName, types );
Object result = method.invoke( null, values );
if(null != var) {
context.setVariable(var, result);
}
ArgTag parentArg = (ArgTag)(findAncestorWithClass(ArgTag.class));
if(null != parentArg) {
parentArg.setValue(result);
}
}
catch (ClassNotFoundException e) {
throw createLoadClassFailedException(e);
}
catch (NoSuchMethodException e) {
throw createLoadClassFailedException(e);
}
catch (IllegalAccessException e) {
throw createLoadClassFailedException(e);
}
catch (InvocationTargetException e) {
if(null != exceptionVar) {
context.setVariable(exceptionVar, e.getTargetException());
} else {
throw new JellyTagException("method " + methodName +
" threw exception: "+ e.getTargetException().getMessage(),
e.getTargetException() );
}
}
finally {
paramTypes.clear();
paramValues.clear();
}
}