pebble
pebble copied to clipboard
IndexOutOfBoundsException when {% endautoescape %} is missing
When parsing any template with Pebble 3.1.4, an IndexOutOfBoundsException occurs when one places an {% autoescape false %} without additionally adding an {% endautoescape %} in the template.
Pebble template:
This is a test
{% autoescape false %}
this is still a test
Stack trace:
Caused by: java.lang.IndexOutOfBoundsException: Index 7 out of bounds for length 7
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:373)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at com.mitchellbosecke.pebble.lexer.TokenStream.next(TokenStream.java:42)
at com.mitchellbosecke.pebble.tokenParser.AutoEscapeTokenParser.parse(AutoEscapeTokenParser.java:49)
at com.mitchellbosecke.pebble.parser.ParserImpl.subparse(ParserImpl.java:195)
at com.mitchellbosecke.pebble.parser.ParserImpl.subparse(ParserImpl.java:104)
at com.mitchellbosecke.pebble.parser.ParserImpl.parse(ParserImpl.java:97)
at com.mitchellbosecke.pebble.PebbleEngine.getPebbleTemplate(PebbleEngine.java:169)
at com.mitchellbosecke.pebble.PebbleEngine.lambda$getTemplate$2(PebbleEngine.java:151)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
at com.mitchellbosecke.pebble.cache.template.ConcurrentMapTemplateCache.computeIfAbsent(ConcurrentMapTemplateCache.java:24)
at com.mitchellbosecke.pebble.cache.template.ConcurrentMapTemplateCache.computeIfAbsent(ConcurrentMapTemplateCache.java:9)
at com.mitchellbosecke.pebble.PebbleEngine.getTemplate(PebbleEngine.java:151)
at com.mitchellbosecke.pebble.PebbleEngine.getTemplate(PebbleEngine.java:122)
at X.Y.Z.X.Y.Z.XYZService.<clinit>(XYZ.kt:27)
... 2 more
Were you expecting the rest of the document to follow that rule or a more descriptive exception?