Tokenizer uses single process step and length-based exhaustion check

Issue: SPR-16032
This commit is contained in:
Juergen Hoeller
2017-10-04 12:23:16 +02:00
parent b2017bb1ec
commit 03b68286a2
3 changed files with 70 additions and 63 deletions
@@ -59,6 +59,7 @@ import org.springframework.expression.spel.support.ReflectivePropertyAccessor;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.expression.spel.support.StandardTypeLocator;
import org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver;
import org.springframework.util.ObjectUtils;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
@@ -2095,6 +2096,16 @@ public class SpelReproTests extends AbstractExpressionTests {
assertEquals(StandardCharsets.UTF_8, result);
}
@Test
public void SPR16032() {
EvaluationContext context = new StandardEvaluationContext();
context.setVariable("str", "a\0b");
Expression ex = parser.parseExpression("#str?.split('\0')");
Object result = ex.getValue(context);
assertTrue(ObjectUtils.nullSafeEquals(result, new String[] {"a", "b"}));
}
public static class ListOf {