Skip to content

[IO-438] Clarify when to use closeQuietly in copy examples - #940

Draft
hutiefang76 wants to merge 2 commits into
apache:masterfrom
hutiefang76:frank/io-438-example-close-errors-20261120
Draft

hutiefang76 wants to merge 2 commits into
apache:masterfrom
hutiefang76:frank/io-438-example-close-errors-20261120

Conversation

@hutiefang76

@hutiefang76 hutiefang76 commented Nov 20, 2026 •

Copy link
Copy Markdown

Addresses IO-438.

The copy examples still show the two closeQuietly overloads. Their captions now say when it is appropriate to ignore close failures. The single-resource overload also explains that closing an output stream or writer can flush buffered data.

The default Maven build and Javadoc generation passed on Java 25. There were 7,620 passing tests and 41 skipped. A Java 8 probe confirmed that each original copy example suppresses the simulated output close exception.

AI assistance: OpenAI Codex assisted the Javadoc revision and validation. DeepSeek reviewed the cumulative diff.

Use try-with-resources in the closeQuietly copy examples so an output close failure reaches the caller.

Assisted-By: OpenAI Codex
@garydgregory

Copy link
Copy Markdown
Member

-1 This is not better. You are documenting different methods now.

@garydgregory
garydgregory marked this pull request as draft November 21, 2026 20:45
Keep the original closeQuietly copy examples and explain when their
cleanup pattern applies. Call out the risk of a buffered output stream
failing during close in the single-resource overload.

Assisted-By: OpenAI Codex and DeepSeek V4 Pro
@hutiefang76 hutiefang76 changed the title [IO-438] Report close failures in copy examples [IO-438] Clarify when to use closeQuietly in copy examples Nov 21, 2026
@hutiefang76

Copy link
Copy Markdown
Author

I restored the original examples in cf98443. The changes now describe when it is appropriate to use the closeQuietly calls shown in those examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants