in src/main/java/org/apache/bsf/engines/javaclass/JavaClassEngine.java [35:54]
public Object call(final Object object, final String method, final Object[] args) throws BSFException {
// determine arg types
Class[] argTypes = null;
if (args != null) {
argTypes = new Class[args.length];
for (int i = 0; i < args.length; i++) {
argTypes[i] = (args[i] != null) ? args[i].getClass() : null;
}
}
// now find method with the right signature, call it and return result
try {
final Method m = MethodUtils.getMethod(object, method, argTypes);
return m.invoke(object, args);
} catch (final Exception e) {
// something went wrong while invoking method
final Throwable t = (e instanceof InvocationTargetException) ? ((InvocationTargetException) e).getTargetException() : null;
throw new BSFException(BSFException.REASON_OTHER_ERROR, "method invocation failed: " + e + ((t == null) ? "" : (" target exception: " + t)), t);
}
}