loosened constructor arg to Throwable

I see no value in InvocationTargetException catching--method invoker now does unwrap of target exception.  Please review.
This commit is contained in:
Keith Donald
2007-04-06 14:02:17 +00:00
parent 33d3d2b8eb
commit 9683ab0f9f
2 changed files with 5 additions and 1 deletions

View File

@@ -44,7 +44,7 @@ public class MethodInvocationException extends NestedRuntimeException {
* @param arguments the arguments
* @param cause the root cause
*/
public MethodInvocationException(MethodSignature methodSignature, Object[] arguments, Exception cause) {
public MethodInvocationException(MethodSignature methodSignature, Object[] arguments, Throwable cause) {
super("Unable to invoke method " + methodSignature + " with arguments " + StylerUtils.style(arguments), cause);
this.methodSignature = methodSignature;
this.arguments = arguments;

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.binding.method;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.commons.logging.Log;
@@ -99,6 +100,9 @@ public class MethodInvoker {
}
return returnValue;
}
catch (InvocationTargetException e) {
throw new MethodInvocationException(signature, arguments, e.getTargetException());
}
catch (Exception e) {
throw new MethodInvocationException(signature, arguments, e);
}