On Thu, Oct 24, 2013 at 4:34 AM, Bernd Eckenfels <e...@zusammenkunft.net> wrote: > Am 24.10.2013, 02:16 Uhr, schrieb Gary Gregory <garydgreg...@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-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org