On Thu, Oct 24, 2013 at 4:34 AM, Bernd Eckenfels <[email protected]> wrote: > Am 24.10.2013, 02:16 Uhr, schrieb Gary Gregory <[email protected]>: > >> 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: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
