SEC-290: Correct bug with generation of SimpleMethodInvocation.

This commit is contained in:
Ben Alex 2006-09-15 03:27:26 +00:00
parent 03df6a90eb
commit 53beadb7bf

View File

@ -72,7 +72,7 @@ public class MethodInvocationUtils {
classArgs = (Class[]) list.toArray(new Class[] {}); classArgs = (Class[]) list.toArray(new Class[] {});
} }
return createFromClass(object.getClass(), methodName, classArgs); return createFromClass(object.getClass(), methodName, classArgs, args);
} }
/** /**
@ -84,7 +84,7 @@ public class MethodInvocationUtils {
* @return a <code>MethodInvocation</code>, or <code>null</code> if there was a problem * @return a <code>MethodInvocation</code>, or <code>null</code> if there was a problem
*/ */
public static MethodInvocation createFromClass(Class clazz, String methodName) { public static MethodInvocation createFromClass(Class clazz, String methodName) {
return createFromClass(clazz, methodName, null); return createFromClass(clazz, methodName, null, null);
} }
/** /**
@ -93,18 +93,18 @@ public class MethodInvocationUtils {
* *
* @param clazz the class of object that will be used to find the relevant <code>Method</code> * @param clazz the class of object that will be used to find the relevant <code>Method</code>
* @param methodName the name of the method to find * @param methodName the name of the method to find
* @param args arguments that are required as part of the method signature * @param classArgs arguments that are required to locate the relevant method signature
* * @param args the actual arguments that should be passed to SimpleMethodInvocation
* @return a <code>MethodInvocation</code>, or <code>null</code> if there was a problem * @return a <code>MethodInvocation</code>, or <code>null</code> if there was a problem
*/ */
public static MethodInvocation createFromClass(Class clazz, String methodName, Class[] args) { public static MethodInvocation createFromClass(Class clazz, String methodName, Class[] classArgs, Object[] args) {
Assert.notNull(clazz, "Class required"); Assert.notNull(clazz, "Class required");
Assert.hasText(methodName, "MethodName required"); Assert.hasText(methodName, "MethodName required");
Method method; Method method;
try { try {
method = clazz.getMethod(methodName, args); method = clazz.getMethod(methodName, classArgs);
} catch (Exception e) { } catch (Exception e) {
return null; return null;
} }