OgnlExpression now unwraps the ognl.OgnlException to make the real exception available to the caller (SWF-255).

This commit is contained in:
Erwin Vervaet
2007-03-26 07:49:15 +00:00
parent 3c01194577
commit 3b129e2fbb
6 changed files with 85 additions and 1 deletions

View File

@@ -74,7 +74,14 @@ class OgnlExpression implements SettableExpression {
return Ognl.getValue(expression, contextAttributes, target);
}
catch (OgnlException e) {
throw new EvaluationException(new EvaluationAttempt(this, target, context), e);
if (e.getReason() != null && e.getReason() != e) {
// unwrap the OgnlException since the actual exception is wrapped inside it
// and there is not generic (getCause) way to get to it later on
throw new EvaluationException(new EvaluationAttempt(this, target, context), e.getReason());
}
else {
throw new EvaluationException(new EvaluationAttempt(this, target, context), e);
}
}
}