]> granicus.if.org Git - icu/commitdiff
ICU-12611 Fix some issues found through static analysis.
authorGeorge Rhoten <grhoten@users.noreply.github.com>
Fri, 9 Sep 2016 14:58:06 +0000 (14:58 +0000)
committerGeorge Rhoten <grhoten@users.noreply.github.com>
Fri, 9 Sep 2016 14:58:06 +0000 (14:58 +0000)
X-SVN-Rev: 39168

icu4j/main/classes/core/src/com/ibm/icu/impl/SimpleFilteredSentenceBreakIterator.java
icu4j/main/classes/core/src/com/ibm/icu/impl/UnicodeRegex.java

index e30e800cf1e6d318750bf195e24c3a0d6f68c65c..27dadb2719a13ce129ddc6884b451556b31103cd 100644 (file)
@@ -89,8 +89,9 @@ public class SimpleFilteredSentenceBreakIterator extends BreakIterator {
             if (bestPosn >= 0) {
                 if (bestValue == Builder.MATCH) { // exact match!
                     n = delegate.next(); // skip this one. Find the next lowerlevel break.
-                    if (n == BreakIterator.DONE)
-                        return n;
+                    if (n == BreakIterator.DONE) {
+                        break;
+                    }
                     continue; // See if the next is another exception.
                 } else if (bestValue == Builder.PARTIAL && forwardsPartialTrie != null) {
                     // make sure there's a forward trie
@@ -107,18 +108,19 @@ public class SimpleFilteredSentenceBreakIterator extends BreakIterator {
                         // only full matches here, nothing to check
                         // skip the next:
                         n = delegate.next();
-                        if (n == BreakIterator.DONE)
-                            return n;
+                        if (n == BreakIterator.DONE) {
+                            break;
+                        }
                         continue;
                     } else {
                         // no match (no exception) -return the 'underlying' break
-                        return n;
+                        break;
                     }
                 } else {
-                    return n; // internal error and/or no forwards trie
+                    break; // internal error and/or no forwards trie
                 }
             } else {
-                return n; // No match - so exit. Not an exception.
+                break; // No match - so exit. Not an exception.
             }
         } while (n != BreakIterator.DONE);
         return n;
index 9c1dc6537e901d96b81aefa0ff29deb33410ac06..9ccf381df0ec4f45d5e7d80235179a95655b407b 100644 (file)
@@ -224,13 +224,13 @@ public class UnicodeRegex implements Cloneable, Freezable<UnicodeRegex>, StringT
                     if (!altered2.equals(definition2)) {
                         unused.remove(variable);
                         variables.put(variable2, altered2);
-                        if (log != null) {
-                            try {
-                                log.append(variable2 + "=" + altered2 + ";");
-                            } catch (IOException e) {
-                                throw (IllegalArgumentException) new IllegalArgumentException().initCause(e);
-                            }
-                        }
+//                        if (log != null) {
+//                            try {
+//                                log.append(variable2 + "=" + altered2 + ";");
+//                            } catch (IOException e) {
+//                                throw (IllegalArgumentException) new IllegalArgumentException().initCause(e);
+//                            }
+//                        }
                     }
                 }
             }
@@ -346,11 +346,11 @@ public class UnicodeRegex implements Cloneable, Freezable<UnicodeRegex>, StringT
         }
     }
 
-    private static UnicodeRegex STANDARD = new UnicodeRegex();
+    private static final UnicodeRegex STANDARD = new UnicodeRegex();
     private String bnfCommentString = "#";
     private String bnfVariableInfix = "=";
     private String bnfLineSeparator = "\n";
-    private Appendable log = null;
+//    private Appendable log = null;
 
     private Comparator<Object> LongestFirst = new Comparator<Object>() {
         public int compare(Object obj0, Object obj1) {