Repository navigation
Treat CRLF as one line terminator in safeReadLine - #931
Open
VolodymyrLinuxovich wants to merge 1 commit into
Open
VolodymyrLinuxovich wants to merge 1 commit into
VolodymyrLinuxovich wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #423.
DefaultValidator.safeReadLine stopped at a CR and left the following LF in the stream. On input with Windows line endings every other call returned an empty line.
When the method reads a CR it now peeks at the next byte and consumes it if it is an LF. Peeking needs mark and reset, so this only happens when the stream supports marks. The Javadoc says so and suggests wrapping the stream in a BufferedInputStream otherwise.
The new test reads LF, CR and CRLF endings plus an empty CRLF line. It also checks the output against BufferedReader.readLine. It fails on develop and passes with this change. ValidatorTest and the access controller tests pass.