google / escapevelocity

A subset reimplementation of Apache Velocity with a much simpler API.
Apache License 2.0
33 stars 11 forks source link

Improve line numbers in exception messages. #26

Closed copybara-service[bot] closed 1 year ago

copybara-service[bot] commented 1 year ago

Improve line numbers in exception messages.

When there is a parsing exception, we read ahead to show up to 20 characters of context. Previously, if that read-ahead included newlines we would include those in the computed line number. Now we show the line number where the parse error occurred, which is more accurate.

This showed up as a test failure with JDK ≥ 16, because this commit changed the behaviour of LineNumberReader such that an EOF without an immediately-preceding newline is treated as if there were an implicit newline there.

RELNOTES=n/a