SPR-6610: don't wrap runtime exceptions thrown from methods invoked via an expression
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user