Bug 189547

Summary: Possible resource leak in org.eclipse.jdt.internal.compiler.parser.Parser
Product: [Eclipse Project] JDT Reporter: Roman Arkhangelskiy <rarkhangelskiy>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, david_audel, frederic_fusier, jerome_lanneluc, pascal, philippe_mulet
Version: 3.3Flags: jerome_lanneluc: review+
aniefer: review+
frederic_fusier: review+
Target Milestone: 3.3 RC3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
possible leak
none
Proposed fix none

Description Roman Arkhangelskiy CLA 2007-05-28 22:06:59 EDT
Build ID: Source code from CVS (28.05.2007)

Steps To Reproduce:
I have been running Jtest's BugDetective feature on Eclipse source code from CVS (28.05.2007) and it reported a possible resource leak in
org.eclipse.jdt.internal.compiler.parser.Parser.java.

The stream allocated at line 443 (buildFileForTable method)
is not closed after its use.

I'm attaching a screenshot from BugDetective which describes the exact flow which may cause the leak.

Please let me know if this is a real problem or BugDetective is mistaken.

Thank you!

More information:
Comment 1 Roman Arkhangelskiy CLA 2007-05-28 22:08:52 EDT
Created attachment 68985 [details]
possible leak
Comment 2 Olivier Thomann CLA 2007-05-28 22:24:48 EDT
*** Bug 189553 has been marked as a duplicate of this bug. ***
Comment 3 Olivier Thomann CLA 2007-05-28 22:25:43 EDT
We don't use this code anymore, but we might want to fix it anyway.
Fix is trivial.
Comment 4 Olivier Thomann CLA 2007-05-28 22:28:31 EDT
Created attachment 68988 [details]
Proposed fix

Philippe, do you want this one for 3.3RC3?
Comment 5 Philipe Mulet CLA 2007-05-29 05:17:23 EDT
If we don't use the code any longer, why not simply discarding it ?
Also, this isn't at all critical then... so why for 3.3 at this stage.

More like hygiene for 3.4.
Comment 6 Olivier Thomann CLA 2007-05-29 09:36:17 EDT
David, are you still using these methods or you are using the internal tool for updating the parser files ?
If you don't use them, I would discard them.
Comment 7 David Audel CLA 2007-05-30 04:57:45 EDT
I use the internal tool.

The methods inside Parser cannot be discarded because this is the only way to update the parser files for someone who don't have access to the internal tool.
Comment 8 Olivier Thomann CLA 2007-05-30 07:11:20 EDT
Maybe the best would be to make the internal tool public.
Philippe, should we fix it regarding David last comment?
The fix is trivial and low risk.
Comment 9 Philipe Mulet CLA 2007-05-30 07:21:02 EDT
If trivial, then go for it. For 3.4, we probably should state on whether we keep them or make the tool public (likely the best).
Comment 10 Olivier Thomann CLA 2007-05-30 11:41:07 EDT
David, Jérôme, Frédéric, please review.
Comment 11 Jerome Lanneluc CLA 2007-05-30 13:40:17 EDT
+1 for 3.3 RC3
Comment 12 Frederic Fusier CLA 2007-05-30 14:00:04 EDT
+1 for 3.3 RC3
Comment 13 Olivier Thomann CLA 2007-05-30 14:32:45 EDT
Pascal, could you please review this patch?
Thanks.
Comment 14 Olivier Thomann CLA 2007-05-30 15:36:53 EDT
Andrew, please review.
Comment 15 Andrew Niefer CLA 2007-05-30 15:49:29 EDT
+1, patch will close the streams.
Comment 16 Olivier Thomann CLA 2007-05-30 15:53:06 EDT
Released for 3.3RC3­.
Roman, could you please verify it using next integration build?
Comment 17 Jerome Lanneluc CLA 2007-06-01 11:11:29 EDT
Verified for 3.3RC3 using I20070601-0010