commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <joerg.schai...@gmx.de>
Subject Re: [imaging] Closing stream
Date Thu, 24 Oct 2013 20:31:47 GMT
Hi Damjan,

Damjan Jovanovic wrote:

> As one of the perpetrators of the problem, I have now fixed it. The
> reasons I swallowed exceptions were simple:

[snip]

> * when an exception is thrown and close() then throws another
> exception, the close() exception is propagated and the original
> exception - which could reveal the cause of the problem - swallowed

[snip]

And this *is* a real problem. And it is exactly why the IOException of 
close() are normally ignored. While I don't like 
IOUtils.closeQietly(closeable), I use normally a method 
"IO.closeLogged(closeable)" resp. "IO.closeLogged(closeable, logger)".

If e.g. an image is corrupted and later on an additional exception occurs 
closing any resource, you will simply *never* learn about the corrupted 
image that caused the problem in first case. The original exception must 
never be swallowed!

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message