commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damjan Jovanovic <damjan....@gmail.com>
Subject Re: [imaging] Closing stream
Date Thu, 24 Oct 2013 04:57:35 GMT
On Thu, Oct 24, 2013 at 4:34 AM, Bernd Eckenfels <ecki@zusammenkunft.net> wrote:
> Am 24.10.2013, 02:16 Uhr, schrieb Gary Gregory <garydgregory@gmail.com>:
>
>>             try {
>>                 if (outputStream != null) {
>>                     outputStream.close();
>>                 }
>>             } catch (final Exception e) {
>>                 Debug.debug(e);
>>             }
>
>
> this calls for a helper or a private method as soon as the code happens more
> than one time in a class IMHO.
>
>
>> All of this is moot in Java 7 with try-with-resources blocks but we are
>> not
>> ready for Java 7 here I imagine.
>
>
> No, t-w-r is similiar broken to manually closing output streams in catch.
> both syntax constructs need a close (flush is optional) inside the try. Some
> filesystems and abstractions layers do nearly all work or error reporting in
> the close only (nfs, quota, webdav, ...)


Wait, what are you saying is wrong with Java 7's try-with-resources?


> Gruss
> Bernd
> --
> http://www.zusammenkunft.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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


Mime
View raw message