diff options
author | Denis Lila <[email protected]> | 2011-03-08 14:48:34 -0500 |
---|---|---|
committer | Denis Lila <[email protected]> | 2011-03-08 14:48:34 -0500 |
commit | 7402c4e21bd5da0b1e66da01b96a3fd9cd24e10e (patch) | |
tree | 17c6cf70ea92c253f85eac144a82798a0659995e /netx/net/sourceforge/jnlp/browser/FirefoxPreferencesFinder.java | |
parent | 261b0560100e15e376cb6bcf64eaabb5a79b24c5 (diff) |
Close streams after we're finished using them.
Diffstat (limited to 'netx/net/sourceforge/jnlp/browser/FirefoxPreferencesFinder.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/browser/FirefoxPreferencesFinder.java | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/netx/net/sourceforge/jnlp/browser/FirefoxPreferencesFinder.java b/netx/net/sourceforge/jnlp/browser/FirefoxPreferencesFinder.java index 34d1092..45f6faa 100644 --- a/netx/net/sourceforge/jnlp/browser/FirefoxPreferencesFinder.java +++ b/netx/net/sourceforge/jnlp/browser/FirefoxPreferencesFinder.java @@ -85,31 +85,34 @@ public class FirefoxPreferencesFinder { */ // find the section with an entry Default=1 - while (true) { - String line = reader.readLine(); - if (line == null) { - break; - } - - line = line.trim(); - if (line.startsWith("[") && line.endsWith("]")) { - if (foundDefaultSection) { + try { + while (true) { + String line = reader.readLine(); + if (line == null) { break; } - // new section - linesInSection = new ArrayList<String>(); - } else { - linesInSection.add(line); - int equalSignPos = line.indexOf('='); - if (equalSignPos > 0) { - String key = line.substring(0, equalSignPos).trim(); - String value = line.substring(equalSignPos+1).trim(); - if (key.toLowerCase().equals("default") && value.equals("1")) { - foundDefaultSection = true; + + line = line.trim(); + if (line.startsWith("[") && line.endsWith("]")) { + if (foundDefaultSection) { + break; + } + // new section + linesInSection = new ArrayList<String>(); + } else { + linesInSection.add(line); + int equalSignPos = line.indexOf('='); + if (equalSignPos > 0) { + String key = line.substring(0, equalSignPos).trim(); + String value = line.substring(equalSignPos+1).trim(); + if (key.toLowerCase().equals("default") && value.equals("1")) { + foundDefaultSection = true; + } } } } - + } finally { + reader.close(); } if (!foundDefaultSection) { |