SPR-6610: don't wrap runtime exceptions thrown from methods invoked via an expression

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2899 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Andy Clement
2010-02-01 20:13:08 +00:00
parent 63ff338dda
commit 55f8409ea0
5 changed files with 66 additions and 11 deletions
@@ -106,9 +106,13 @@ public class ConstructorReference extends SpelNodeImpl {
Throwable rootCause = (causeOfAccessException==null?null:causeOfAccessException.getCause());
if (rootCause!=null) {
// User exception was the root cause - exit now
String typename = (String) children[0].getValueInternal(state).getValue();
throw new SpelEvaluationException(getStartPosition(), rootCause, SpelMessage.CONSTRUCTOR_INVOCATION_PROBLEM,
typename,FormatHelper.formatMethodForMessage("", argumentTypes));
if (rootCause instanceof RuntimeException) {
throw (RuntimeException)rootCause;
} else {
String typename = (String) children[0].getValueInternal(state).getValue();
throw new SpelEvaluationException(getStartPosition(), rootCause, SpelMessage.CONSTRUCTOR_INVOCATION_PROBLEM,
typename,FormatHelper.formatMethodForMessage("", argumentTypes));
}
}
// at this point we know it wasn't a user problem so worth a retry if a better candidate can be found
@@ -93,8 +93,12 @@ public class MethodReference extends SpelNodeImpl {
Throwable rootCause = (causeOfAccessException==null?null:causeOfAccessException.getCause());
if (rootCause!=null) {
// User exception was the root cause - exit now
throw new SpelEvaluationException( getStartPosition(), rootCause, SpelMessage.EXCEPTION_DURING_METHOD_INVOCATION,
if (rootCause instanceof RuntimeException) {
throw (RuntimeException)rootCause;
} else {
throw new SpelEvaluationException( getStartPosition(), rootCause, SpelMessage.EXCEPTION_DURING_METHOD_INVOCATION,
this.name, state.getActiveContextObject().getValue().getClass().getName(), rootCause.getMessage());
}
}
// at this point we know it wasn't a user problem so worth a retry if a better candidate can be found