Bug 189547 - Possible resource leak in org.eclipse.jdt.internal.compiler.parser.Parser
Summary: Possible resource leak in org.eclipse.jdt.internal.compiler.parser.Parser
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 RC3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 189553 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-05-28 22:06 EDT by Roman Arkhangelskiy CLA
Modified: 2007-06-01 11:11 EDT (History)
6 users (show)

See Also:
jerome_lanneluc: review+
aniefer: review+
frederic_fusier: review+


Attachments
possible leak (270.53 KB, image/jpeg)
2007-05-28 22:08 EDT, Roman Arkhangelskiy CLA
no flags Details
Proposed fix (1.15 KB, patch)
2007-05-28 22:28 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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