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