Skip to content

release resources in COSInputStream#463

Open
valerybokov wants to merge 1 commit into
apache:trunkfrom
valerybokov:release-resources-in-COSInputStream
Open

release resources in COSInputStream#463
valerybokov wants to merge 1 commit into
apache:trunkfrom
valerybokov:release-resources-in-COSInputStream

Conversation

@valerybokov
Copy link
Copy Markdown

No description provided.

@msahyoun
Copy link
Copy Markdown

msahyoun commented Jun 2, 2026

nit: the brace style of the new close() method uses same-line opening braces, while the rest of COSInputStream uses Allman style per PDFBox standard

@THausherr
Copy link
Copy Markdown
Contributor

Copilot suggests this could be refactored so that it stores only the last element of decodeResults and that makes sense. And if we null that one, then we should mention in the javadoc that getDecodeResult() is not to be called after close().

@valerybokov
Copy link
Copy Markdown
Author

Copilot suggests this could be refactored so that it stores only the last element of decodeResults and that makes sense. And if we null that one, then we should mention in the javadoc that getDecodeResult() is not to be called after close().

This is bad idea to use the stream after its closing. Any method can throw IllegalOperationException (the stream is closed). IMHO, you shouldn't write something like "this method can/cannot be called when the stream is closed". Any method not recommended to call when the stream is closed.

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.

3 participants