Protect against missing SpEL selection expression
Update InternalSpelExpressionParser to ensure that SPeL selections
('$[...]', '^[...]', '?[...]') always include a nested expression.
Issue: SPR-10328
This commit is contained in:
@@ -27,6 +27,7 @@ import static org.junit.Assert.fail;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -1744,6 +1745,14 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
parseExpression.getValue(context);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void SPR_10328() throws Exception {
|
||||
thrown.expect(SpelParseException.class);
|
||||
thrown.expectMessage("EL1071E:(pos 2): A required selection expression has not been specified");
|
||||
Expression exp = parser.parseExpression("$[]");
|
||||
exp.getValue(Arrays.asList("foo", "bar", "baz"));
|
||||
}
|
||||
|
||||
public static class BooleanHolder {
|
||||
|
||||
private Boolean simpleProperty = true;
|
||||
|
||||
Reference in New Issue
Block a user