[jira] [Commented] (IO-303) TeeOutputStream does not call branch.close() when main.close() throws an exception
[ https://issues.apache.org/jira/browse/IO-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13210625#comment-13210625 ] Fabian Barney commented on IO-303: -- This is ok I think. Here's how I would write it but it is just a matter of taste... {noformat} @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } {noformat} TeeOutputStream does not call branch.close() when main.close() throws an exception -- Key: IO-303 URL: https://issues.apache.org/jira/browse/IO-303 Project: Commons IO Issue Type: Bug Components: Streams/Writers Affects Versions: 2.1 Reporter: Fabian Barney Assignee: Gary D. Gregory Labels: close, stream Fix For: 2.2 TeeOutputStream.close() looks like this: {code:title=TeeOutputStream.java|borderStyle=solid} /** * Closes both streams. * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { super.close(); this.branch.close(); } {code} It is obvious that {{this.branch.close()}} is not executed when {{super.close()}} raises an exception. {{super.close()}} may in fact raise an IOException since {{ProxyOutputStream.handleIOException(IOException)}} is not overridden. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (IO-303) TeeOutputStream does not call branch.close() when main.close() throws an exception
[ https://issues.apache.org/jira/browse/IO-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13210651#comment-13210651 ] Gary D. Gregory commented on IO-303: Looks reasonable, re-implemented in SVN as above. TeeOutputStream does not call branch.close() when main.close() throws an exception -- Key: IO-303 URL: https://issues.apache.org/jira/browse/IO-303 Project: Commons IO Issue Type: Bug Components: Streams/Writers Affects Versions: 2.1 Reporter: Fabian Barney Assignee: Gary D. Gregory Labels: close, stream Fix For: 2.2 TeeOutputStream.close() looks like this: {code:title=TeeOutputStream.java|borderStyle=solid} /** * Closes both streams. * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { super.close(); this.branch.close(); } {code} It is obvious that {{this.branch.close()}} is not executed when {{super.close()}} raises an exception. {{super.close()}} may in fact raise an IOException since {{ProxyOutputStream.handleIOException(IOException)}} is not overridden. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (IO-303) TeeOutputStream does not call branch.close() when main.close() throws an exception
[ https://issues.apache.org/jira/browse/IO-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13210654#comment-13210654 ] Gary D. Gregory commented on IO-303: YW. BTW, feel free to contribute patches and to improve the test coverage too! :) TeeOutputStream does not call branch.close() when main.close() throws an exception -- Key: IO-303 URL: https://issues.apache.org/jira/browse/IO-303 Project: Commons IO Issue Type: Bug Components: Streams/Writers Affects Versions: 2.1 Reporter: Fabian Barney Assignee: Gary D. Gregory Labels: close, stream Fix For: 2.2 TeeOutputStream.close() looks like this: {code:title=TeeOutputStream.java|borderStyle=solid} /** * Closes both streams. * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { super.close(); this.branch.close(); } {code} It is obvious that {{this.branch.close()}} is not executed when {{super.close()}} raises an exception. {{super.close()}} may in fact raise an IOException since {{ProxyOutputStream.handleIOException(IOException)}} is not overridden. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira