[
https://issues.apache.org/jira/browse/IO-546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16133461#comment-16133461
]
ASF GitHub Bot commented on IO-546:
-----------------------------------
GitHub user tjcelaya opened a pull request:
https://github.com/apache/commons-io/pull/42
[IO-546] ClosedOutputStream#flush should throw
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.
See [IO-546](https://issues.apache.org/jira/browse/IO-546) where @dekobon
has attached an example program.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tjcelaya/commons-io
fix/IO-546-ClosedOutputStream-flush
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/commons-io/pull/42.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #42
----
commit 854ed1d0d4495fa400dc4128d0e7374accb3f9c1
Author: Tomas Celaya <[email protected]>
Date: 2017-08-18T18:47:20Z
ClosedOutputStream#flush should throw
----
> ClosedOutputStream#flush should throw
> -------------------------------------
>
> Key: IO-546
> URL: https://issues.apache.org/jira/browse/IO-546
> 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.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)