Hi
If I have the following code in a servlet:
Properties p = new Properties();
p.load(getClass().getResourceAsStream("/test.properties"));
If I run the servlet through FindBugs, I would expect to get the warning OS_OPEN_STREAM, but I don't. If I use a similar approach to open an arbitrary file on the filesystem (ie not in the classpath), I get the Findbugs warning as expected:
Properties p = new Properties();
p.load(new FileInputStream(new File("c:/test.properties")));
In the first example, is the warning absent because Findbugs is missing a valid warning (ie I should be closing the stream in a finally block after loading into the Properties object) or is there a reason I don't need to close the stream?
Thanks
Rich