commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Benedict (JIRA)" <>
Subject [jira] Commented: (IO-249) Enhance closeQuietly to indicate success
Date Thu, 30 Sep 2010 22:24:32 GMT


Paul Benedict commented on IO-249:

JDK 7 is introducing the notion of [suppressed exceptions|].
These are exceptions that were not the cause of an exception, but were suppressed away because
they shouldn't stop control flow. IOUtils does exactly this -- it's used commonly to close
resources but the exceptions are unfortunately thrown away. All I am asking for is a way to
get visibility to them without the complex try/catch block that closeQuietly() is intended
to replace. If my current suggestion is not palatable, I then recommend the signature be:
closeQuietly(e, Exception primary) so that suppression can be done.

> Enhance closeQuietly to indicate success
> ----------------------------------------
>                 Key: IO-249
>                 URL:
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 2.0
>            Reporter: Paul Benedict
>            Assignee: Paul Benedict
>            Priority: Minor
>             Fix For: 2.x
> A convention of some programmers is to emit a log warning when a resource fails to close.
Granted, such a condition is an error, but there's no reasonable recourse to the failure.
Using IOUtils.closeQuietly() is very useful but all information about the success/failure
is hidden. Returning Throwable will give insight into the error for diagnostic purposes. This
change will be compatible with today's usage since the method currently returns void.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message