Community
Participate
Working Groups
I have been running Jtest's BugDetective feature on Eclipse source code (build of 29.10.2006) and it reported several possible resource leaks: in org.eclipse.jdt.internal.compiler.parser.Parser: 1. writer.close() at line 231 will not be executed if an exception is thrown at line 230 (call to flush()); 2. The same is with stream.close():429, which will not be reached if stream.write(bytes):428 thrown an exception; 3. stream.close():442 - the same problem. in org.eclipse.jdt.internal.compiler.ClassFile: output.close():383 will not be reached if the previous line (call to flush()) throws an exception; Please let me know if this is a real problem or BugDetective is mistaken. Thank you!
Released for 3.3M4. Yes, they were potential resource leaks, but the methods in the Parser are not used directly inside Eclipse. They are used to generate the resource files of the Parser. I changed the code in the ClassFile to be sure that output.close() is called. If it raised an IOException, the same handling is done.
Could you please try again on the code in HEAD and let me know if the same problems are found?
I have done it as you requested and happy to report that this time no resource leaks have been found. Thank you!
Verified for 3.3 M4 by reporter