I quickly searched the source for opening files with
FileInputStream. I fixed closing it after reading is done in several
places.
I want to warn. The common, I think mistake, in loading properties is

Properties props = new Properties();
props.load(new FileInputStream(new File("filename")));

After this the file will remain opened and can't be removed on
windows. I am not sure whether it will be possible after gc will
reclaim FileInputStream.

So, the correct way is
Properties props = new Properties();
FileInputStream fis = new FileInputStream(new File("filename"));
props.load(fis);
fis.close();

A few other places I met quickly surfing the source that look fishily.
Maybe streams are closed in other methods?

org.mortbay.html.Image.java
 101: public Image setSizeFromGif(File gif)

org.jboss.web.AbstractWebContainer
 838,841: protected WebMetaData parseMetaData(String ctxPath, URL warURL)

org.mortbay.http.HashUserRealm
 111: public void load(String config) // loading properties

org.mortbay.http.JDBCUserRealm
 100: public void loadConfig(String config) // loading properties

(line numbers for JBoss-3.2)

alex




-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to