Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 12 Aug 2011 14:26:17 -0500 Date: Fri, 12 Aug 2011 12:26:14 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 23 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 70.230.203.65 X-Trace: sv3-EugcEOR5zCl3UgPmD18bcsiuK0bjnAtXqkHDHa3w1HJJWBzGudX0d8bOSMACpGTWK7J2eeH3yMZC9v6!565/mMQ6AgT4yQZRwkcsmWjnEO6AQKmUUNB8kDGFDGOegcR2CRErpev08prtVfjhyOCZ3apHgHIm!ge/m2Mp1hPqCeHXGYnreHNBVj8lMTlA1ZXahKAy66ecJBw== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2384 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7053 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 >> , 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