Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7053

Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound

Date 2011-08-12 12:26 -0700
From Patricia Shanahan <pats@acm.org>
Newsgroups comp.lang.java.programmer
Subject Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound
References <0f7fb5c4-6031-4778-9ef7-de757bbdda39@m5g2000prh.googlegroups.com> <j23iht$2jl$1@dont-email.me> <ec849d69-925d-4036-bf2a-be97b66da056@j37g2000prh.googlegroups.com> <j23tnl$hkd$1@dont-email.me>
Message-ID <FOidnQnGt87H49jTnZ2dnUVZ_uGdnZ2d@earthlink.com> (permalink)

Show all headers | View raw


On 8/12/2011 12:08 PM, markspace wrote:
> On 8/12/2011 11:19 AM, KevinSimonson wrote:
>> new FileWriter( arguments[ 1])));
>
>> So try running this program and doing various things to the two
>> files. If you can find something that actually generates a
>> <IOException>, please, _please_, let me know what you did!
>
>
> The FileWriter constructor is declared to generate an IOExcpetion. I
> don't have time to mess with it, but it's likely a large variety of
> network file systems could generate an IO error of various types.
>
> While any other error might be swallowed by the PrintWriter, you are
> briefly exposed to the vagaries file system while that constructor is
> running.

As currently implemented, I believe FileNotFoundException is the only
checked exception the FileWriter constructors throw. However, designers
of an API that may be very difficult to change should take a broad view
of what checked exceptions they might need to throw in the future.

Patricia

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound KevinSimonson <kvnsmnsn@hotmail.com> - 2011-08-12 08:39 -0700
  Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound Knute Johnson <september@knutejohnson.com> - 2011-08-12 08:54 -0700
  Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound markspace <-@.> - 2011-08-12 08:57 -0700
    Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound KevinSimonson <kvnsmnsn@hotmail.com> - 2011-08-12 11:19 -0700
      Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound markspace <-@.> - 2011-08-12 12:08 -0700
        Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound Patricia Shanahan <pats@acm.org> - 2011-08-12 12:26 -0700
      Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-12 19:35 +0000
  Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound Patricia Shanahan <pats@acm.org> - 2011-08-12 12:31 -0700
    Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound KevinSimonson <kvnsmnsn@hotmail.com> - 2011-08-12 13:10 -0700
  Re: Trying to Understand Purpose of a Catch Block for IOException in the Presence of One for FileNotFound Lew <lewbloch@gmail.com> - 2011-08-12 14:27 -0700

csiph-web