SPR-6059 Avoiding NPE for OR operator. If the value is null instead of a valid boolean or Boolean, it will now trigger an EvaluationException.

This commit is contained in:
Mark Fisher
2009-10-28 23:14:29 +00:00
parent 4a315ba6d1
commit 53eb612a68
4 changed files with 58 additions and 7 deletions

View File

@@ -308,6 +308,26 @@ public class EvaluationTests extends ExpressionTestCase {
parser.parseExpression("!null").getValue();
}
@Test(expected = EvaluationException.class)
public void testAndWithNullValueOnLeft() {
parser.parseExpression("null and true").getValue();
}
@Test(expected = EvaluationException.class)
public void testAndWithNullValueOnRight() {
parser.parseExpression("true and null").getValue();
}
@Test(expected = EvaluationException.class)
public void testOrWithNullValueOnLeft() {
parser.parseExpression("null or false").getValue();
}
@Test(expected = EvaluationException.class)
public void testOrWithNullValueOnRight() {
parser.parseExpression("false or null").getValue();
}
// assignment
@Test
public void testAssignmentToVariables01() {