From 1234c9e54d64140d54d873c2ff7a7929e25b9f55 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Tue, 5 Jul 2016 13:10:46 +0000 Subject: [PATCH] ICU-12611 Fix some issues found through static analysis. X-SVN-Rev: 38939 --- .../com/ibm/icu/impl/ICUResourceBundle.java | 16 ++++++---- .../ibm/icu/impl/TimeZoneGenericNames.java | 31 ++++++++++--------- .../ibm/icu/impl/UnicodeSetStringSpan.java | 4 ++- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUResourceBundle.java b/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUResourceBundle.java index 9db8b8f240..686a7fd7f0 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUResourceBundle.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUResourceBundle.java @@ -670,15 +670,19 @@ public class ICUResourceBundle extends UResourceBundle { InputStream s = root.getResourceAsStream(bn + FULL_LOCALE_NAMES_LIST); if (s != null) { BufferedReader br = new BufferedReader(new InputStreamReader(s, "ASCII")); - String line; - while ((line = br.readLine()) != null) { - if (line.length() != 0 && !line.startsWith("#")) { - locales.add(line); + try { + String line; + while ((line = br.readLine()) != null) { + if (line.length() != 0 && !line.startsWith("#")) { + locales.add(line); + } } } - br.close(); + finally { + br.close(); + } } - } catch (IOException e) { + } catch (IOException ignored) { // swallow it } } diff --git a/icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneGenericNames.java b/icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneGenericNames.java index caaf039817..2e6fe36586 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneGenericNames.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneGenericNames.java @@ -596,10 +596,21 @@ public class TimeZoneGenericNames implements Serializable, Freezable(); } @@ -811,11 +818,7 @@ public class TimeZoneGenericNames implements Serializable, Freezable