Repository navigation
[CSV-334] Close file writers when printer construction fails - #648
Open
hutiefang76 wants to merge 1 commit into
Open
hutiefang76 wants to merge 1 commit into
hutiefang76 wants to merge 1 commit into
Conversation
Close the writer opened by the path overload if writing the header fails. Keep the original construction failure and suppress a distinct close failure. 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: CSV-334, reported by Qiuye Wang.
CSVFormat.print(Path, Charset)opens a writer before constructing a printer. If writing a header during construction fails, the caller never receives a printer to close. Close the writer on that failure path, keep the original exception, and suppress a distinct close failure. A caller-supplied appendable remains with the caller if printer construction fails.The close-on-failure regression failed on the original behavior for both distinct and identical exception instances. Ownership controls and both regression cases pass after the fix. A POSIX FIFO probe that closes its reader during header output still reports the same broken pipe. The Java process retains one extra file descriptor with the original code and none with the fix.
The default Maven build on Java 17 passed with 982 tests executed and 11 existing skips. The Java 8 format suite passed all 120 tests, including the four added cases.
Assisted-Bytrailers.