Project: JDT
Bug 52062 [spell checking] SpellCheckEngine.getAvailableLocales() should close its input streams
Reported: 2004-02-14 16:14:53 | Status: resolved fixed

3.0M7 stable. I was just digging around the new code out of curiousity and found a place where streams are opened but never closed. I believe this is not strictly a resource leak because Java finalization will eventually close the stream, but it wouldn't hurt to do it explicitly. stream= url.openStream(); if (stream != null) result.add(locale); stream.close(); // add me As an aside, this looks like a very indirect way of iterating over dictionaries. Perhaps they should be supplied via fragments bound to an appropriate extension point. Also, the function always includes the default locale even if no dictionaries were found. I think this behaviour is misleading and prevents the UI from presenting a more useful "no dictionaries available" kind of cue, if none were installed (as in M7?). Looks good. I hope this support gets generalized somewhat and moved into org.eclipse.text eventually.

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/spelling/SpellCheckEngine.java