Note that modern code analysers (like the one in IDEA, but probably others too) can find, IIRC, such bugs (or potential bugs).

  S.

On Dec 9, 2006, at 3:00 PM, Bogdan Stefanescu wrote:


I've seen several time in nuxeo sources that streams are not closed after being used. This is very bad. File or URL streams are system resources and you must close them manually.
Please pay attention to this sort of things.

An Example from JNDILookupHelper:

serverContainerLocation.load(jndiResourceURL.openStream());

This is *bad*.

You should write it like this:

InputStream in = null;
try {
   in = jndiResourceURL.openStream();
   // do something with the stream
   // ...
} finally {
   // close the stream!
   if (in != null) in.close();
}


Bogdan


_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm


--
Stefane Fermigier, CEO, Nuxeo SAS
Open Source Enterprise Content Management (ECM)
Nuxeo 5 EP is out! - Now Java EE based, standards compliant
Web: http://www.nuxeo.com/ - Tel: +33 1 40 33 79 87


_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to