Bug 52062 [spell checking] SpellCheckEngine.getAvailableLocales() should close its input streams
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.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/spelling/SpellCheckEngine.java
try {
					final URL url= new URL("file", null, file);
					if (url.openStream() != null) {
						fUserDictionary= new PersistentSpellDictionary(url);
						fChecker.addDictionary(fUserDictionary);
					}
				} catch (MalformedURLException exception) {
					
				} catch (IOException exception) {
					
				}
			}
		}
	}
	/*
	 * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellCheckEngine#registerDictionary(org.eclipse.jdt.ui.text.spelling.engine.ISpellDictionary)
	 */
	public synchronized final void registerDictionary(final ISpellDictionary dictionary) {
		fGlobalDictionaries.add(dictionary);
		if (fChecker != null)
			fChecker.addDictionary(dictionary);
	}
	/*
	 * @see org.eclipse.jdt.ui.text.spelling.engine.ISpellCheckEngine#registerDictionary(java.util.Locale,org.eclipse.jdt.ui.text.spelling.engine.ISpellDictionary)
	 */
	public synchronized final void registerDictionary(final Locale locale, final ISpellDictionary dictionary) {
		fLocaleDictionaries.put(locale, dictionary);
		if (fChecker != null && fLocale != null && fLocale.equals(locale))
			fChecker.addDictionary(dictionary);
	}