diff --git a/spring-binding/src/main/java/org/springframework/binding/method/MethodInvocationException.java b/spring-binding/src/main/java/org/springframework/binding/method/MethodInvocationException.java index bf2e5f7a..6e9f5ac6 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/MethodInvocationException.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/MethodInvocationException.java @@ -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; diff --git a/spring-binding/src/main/java/org/springframework/binding/method/MethodInvoker.java b/spring-binding/src/main/java/org/springframework/binding/method/MethodInvoker.java index 36a9f8dc..44832a6a 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/MethodInvoker.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/MethodInvoker.java @@ -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); }