Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BEF49103EB for ; Thu, 24 Oct 2013 20:32:41 +0000 (UTC) Received: (qmail 18300 invoked by uid 500); 24 Oct 2013 20:32:33 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 17514 invoked by uid 500); 24 Oct 2013 20:32:28 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 17503 invoked by uid 99); 24 Oct 2013 20:32:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Oct 2013 20:32:26 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jak-commons-dev@m.gmane.org designates 80.91.229.3 as permitted sender) Received: from [80.91.229.3] (HELO plane.gmane.org) (80.91.229.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Oct 2013 20:32:19 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VZRZW-000834-4c for dev@commons.apache.org; Thu, 24 Oct 2013 22:31:58 +0200 Received: from hsi-kbw-109-192-231-080.hsi6.kabel-badenwuerttemberg.de ([109.192.231.80]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 24 Oct 2013 22:31:58 +0200 Received: from joerg.schaible by hsi-kbw-109-192-231-080.hsi6.kabel-badenwuerttemberg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 24 Oct 2013 22:31:58 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: dev@commons.apache.org From: =?UTF-8?B?SsO2cmc=?= Schaible Subject: Re: [imaging] Closing stream Date: Thu, 24 Oct 2013 22:31:47 +0200 Lines: 26 Message-ID: References: Reply-To: joerg.schaible@gmx.de Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: hsi-kbw-109-192-231-080.hsi6.kabel-badenwuerttemberg.de User-Agent: KNode/4.10.5 X-Virus-Checked: Checked by ClamAV on apache.org 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