commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elijah Zupancic (JIRA)" <>
Subject [jira] [Commented] (IO-546) ClosedOutputStream#flush should throw
Date Wed, 16 Aug 2017 00:56:01 GMT


Elijah Zupancic commented on IO-546:

bq. ClosedOutputStream#flush is not overridden and will silently succeed.

If I am understanding this correctly, when close() is called for the first time, any methods
that are wrapped in the {{ProxyOutputStream}} are no longer available. This seems pathological.
The purpose of this class is to prevent close() from being called on the underlying stream.
If it is called accidentally, then the underlying stream _should_ still be open and methods
like flush() should be available.

> ClosedOutputStream#flush should throw
> -------------------------------------
>                 Key: IO-546
>                 URL:
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Streams/Writers
>            Reporter: Tomas Celaya
>            Priority: Minor
>         Attachments: IO-546.patch
> While debugging an issue involving usage of {{CloseShieldOutputStream}} I discovered
that {{ClosedOutputStream#flush}} is not overridden and will silently succeed. Not sure how
much of a breaking change this might be but I think it makes more sense for {{ClosedOutputStream#flush}}
to throw. This is only really meaningful in contexts where multiple streams are being chained
together and some of the streams before {{CloseShieldOutputStream}} perform buffering, but
it would make behavior more consistent for these more complex use-cases.
> No patches are included because I'm interested in hearing what the opinion would be on
this issue. I can provide a patch if this seems like desired behavior.

This message was sent by Atlassian JIRA

View raw message