Bug 163782 - Possible resource leaks
Summary: Possible resource leaks
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-08 05:21 EST by Roman Arkhangelskiy CLA
Modified: 2006-12-13 03:27 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Arkhangelskiy CLA 2006-11-08 05:21:53 EST
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!
Comment 1 Olivier Thomann CLA 2006-11-08 10:57:17 EST
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.
Comment 2 Olivier Thomann CLA 2006-11-08 10:59:04 EST
Could you please try again on the code in HEAD and let me know if the same problems are found?
Comment 3 Roman Arkhangelskiy CLA 2006-11-09 04:23:17 EST
I have done it as you requested and happy to report that this time no resource leaks have been found. Thank you!
Comment 4 Frederic Fusier CLA 2006-12-13 03:27:44 EST
Verified for 3.3 M4 by reporter