Except when you have to close multiple resources... Also, JDBC throws
Exceptions quite often on close :-)

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: [email protected]


> -----Original Message-----
> From: Jukka Zitting [mailto:[email protected]]
> Sent: Wednesday, August 31, 2011 7:25 PM
> To: [email protected]
> Subject: Re: Tika leaves files open
> 
> Hi,
> 
> On Wed, Aug 31, 2011 at 6:53 PM, Uwe Schindler <[email protected]> wrote:
> > For this typical try...finally code I suggest to use a pre-Java-7.0
> > workaround to make this behave more correct: If you do try...finally
> > and another Exception occurs on close() in the finally block, you lose
> > the first Exception.
> 
> Such a case is certainly possible scenario, but in my experience it
practically
> never occurs. I've used the try { ... } finally { stream.close(); }
pattern
> extensively for years, and I've never seen a case where information was
lost
> because of this.
> 
> So personally I consider the problem rather theoretical and would rather
opt
> for cleaner code that avoids the extra constructs.
> 
> BR,
> 
> Jukka Zitting

Reply via email to