Repository navigation
[CSV-332] Keep the current line number at zero for empty input - #646
Open
hutiefang76 wants to merge 1 commit into
Open
hutiefang76 wants to merge 1 commit into
hutiefang76 wants to merge 1 commit into
Conversation
Do not count the initial EOF as a line when no character has been read. Extend the existing empty-input regressions for the reader and parser. Assisted-By: DeepSeek V4 Pro Assisted-By: OpenAI Codex
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.
Jira: https://issues.apache.org/jira/browse/CSV-332, reported by Sergi Parpal.
After an empty CSV input reaches EOF,
CSVParser.getCurrentLineNumber()changes from0to1even though no character was read. Exclude the initialUNDEFINEDstate from the EOF line-count increment inExtendedBufferedReader.read().Extend the existing empty-reader, empty-file and empty-string tests to check that the line number remains zero after reaching EOF, including repeated parser reads. All three tests fail on the original production code and pass with the fix. Existing CR, LF, CRLF and CSV-149 nonempty final-line regressions also execute successfully.
The default
mvn -B -ntpbuild passed on Java 17 with Java 8 release: 978 tests executed, 11 existing disabled tests skipped, no failures or errors. This includes RAT, binary compatibility, SpotBugs, PMD/CPD, Javadoc, coverage and Checkstyle checks. The reader/parser classes also passed on an actual Java 8 runtime: 184 tests executed, four existing disabled tests skipped; all three changed empty-input tests executed.deepseek-v4-proprepared the code, regressions and first-pass review; OpenAI Codex coordinated verification, formatting and this PR text.Assisted-Bytrailers.