Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #742
| From | rossum <rossum48@coldmail.com> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: TeeOutputStream? |
| Date | 2011-06-06 15:16 +0100 |
| Message-ID | <ttnpu697se9frpea82lgt0naaq2bjb9b1d@4ax.com> (permalink) |
| References | <YVzGp.501$_I7.309@newsfe08.iad> <ihpmu61t1pdfja3rsvh1f8rqaoafqof838@4ax.com> <isgvlo$8e1$1@dont-email.me> |
On Mon, 06 Jun 2011 01:23:53 +0300, Stanimir Stamenkov
<s7an10@netscape.net> wrote:
>Sun, 05 Jun 2011 12:23:09 +0100, /rossum/:
>
>> public void close() throws IOException {
>>
>> IOException firstFail = null;
>> IOException secondFail = null;
>>
>> try {
>> try {
>> os1.close();
>> } catch (IOException ioe1) {
>> firstFail = ioe1;
>
>Wouldn't this approach fail in face of RuntimeException or Error thrown?
This particular code would. The OP only talked about IOExceptions so
I coded to that. It is trivial to amend the code to catch whatever
type of throwable you want to.
rossum
>
>> logger.log(Level.SEVERE,
>> "First stream failure IOexception", ioe1);
>> }
>> try {
>> os2.close();
>> } catch (IOException ioe2) {
>> secondFail = ioe2;
>> logger.log(Level.SEVERE,
>> "Second stream failure IOexception", ioe2);
>> }
>> } finally {
>> if (firstFail != null) {
>> if (secondFail != null) {
>> [...]
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar
TeeOutputStream? Knute Johnson <nospam@knutejohnson.com> - 2011-06-04 17:17 -0700
Re: TeeOutputStream? Roedy Green <see_website@mindprod.com.invalid> - 2011-06-04 22:18 -0700
Re: TeeOutputStream? Stanimir Stamenkov <s7an10@netscape.net> - 2011-06-05 10:44 +0300
Re: TeeOutputStream? rossum <rossum48@coldmail.com> - 2011-06-05 12:23 +0100
Re: TeeOutputStream? Stanimir Stamenkov <s7an10@netscape.net> - 2011-06-06 01:23 +0300
Re: TeeOutputStream? Patricia Shanahan <pats@acm.org> - 2011-06-05 16:55 -0700
Re: TeeOutputStream? Stanimir Stamenkov <s7an10@netscape.net> - 2011-06-07 00:45 +0300
Re: TeeOutputStream? rossum <rossum48@coldmail.com> - 2011-06-06 15:16 +0100
Re: TeeOutputStream? markspace <-@.> - 2011-06-06 14:08 -0700
Re: TeeOutputStream? Henk van Voorthuijsen <voorth@gmail.com> - 2011-06-08 03:31 -0700
Re: TeeOutputStream? Knute Johnson <nospam@knutejohnson.com> - 2011-06-08 16:11 -0700
csiph-web