Do not ignore exceptions when closing Closeable's

Description

In many places, the method IOUtils.closeQuietly() is used to unconditionally close objects that implement the interface Closable (FileInputStreams, FileOutputStreams, ...).
Although the use of this method in finally blocks is correct and fits its purpose, Closable's should be additionally closed using the method close() within the corresponding try blocks. Otherwise, exceptions that could occur when closing a Closable will simply be ignored - possibly leading to unnoticed data corruption/loss.

Although failing on close() maybe unlikely and I do not provide the requested steps of reproduction here, its possible consequences should be absolutely avoided.

References:
See the code examples of method closeQuietly() on http://commons.apache.org/proper/commons-io/javadocs/api-2.4/org/apache/commons/io/IOUtils.html#closeQuietly(java.io.Closeable)

Assignee

Sven Stauber

Reporter

Sven Stauber

Tags (folksonomy)

None

Components

Fix versions

Affects versions

Priority

Major
Configure