You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit adds tests for fast-forward lines surrounded by spaces.
This commit also adds a test for limited, non-terminal fast-forward exceeding
actual lines.
Prior to this commit, isFastForwardLine and parseFastForwardLimit currently
didn't match each other in how they handle spaces on the outside of the
fast-forward markers.
> isFastForwardLine allows them and will detect " >> 2 >> " as a
> fast-forward line, but parseFastForwardLimit does not handle the spaces
> correctly. It only trims the line that substring(int, int) is invoked on
> and does not do so when determining the end index based on the string
> length.
> This can lead to an IndexOutOfBoundsException being thrown for strings
> with three or more surrounding spaces, like " >> 2 >> ". Strings with
> one or two surround spaces, like " >> 2 >> ", are treated like an
> unlimited fast-forward.
Now, a trimmed line is passed to parseFastForwardLimit before any further
usage. This implementation is analogous to the implementation in
isFastForwardLine that reassigns the trimmed line to the parameter.
Also, an NoSuchElementException is prevented when fast-forward exceeds
the number of actual lines.
0 commit comments