Merge "Update dictionaries"
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
index e5e00d5..cf61855 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
@@ -49,6 +49,7 @@
  * queries in native code. This binary dictionary is written to internal storage.
  */
 abstract public class ExpandableBinaryDictionary extends Dictionary {
+    private static final boolean DEBUG = false;
 
     /** Used for Log actions from this class */
     private static final String TAG = ExpandableBinaryDictionary.class.getSimpleName();
@@ -325,16 +326,17 @@
     protected void addNgramEntryLocked(final PrevWordsInfo prevWordsInfo, final String word,
             final int frequency, final int timestamp) {
         if (!mBinaryDictionary.addNgramEntry(prevWordsInfo, word, frequency, timestamp)) {
-            Log.e(TAG, "Cannot add n-gram entry.");
-            Log.e(TAG, "  PrevWordsInfo: " + prevWordsInfo);
-            Log.e(TAG, "  word: " + word);
+            if (DEBUG) {
+                Log.i(TAG, "Cannot add n-gram entry.");
+                Log.i(TAG, "  PrevWordsInfo: " + prevWordsInfo + ", word: " + word);
+            }
         }
     }
 
     /**
      * Dynamically remove the n-gram entry in the dictionary.
      */
-    public void removeNgramDynamically(final PrevWordsInfo prevWordsInfo, final String word1) {
+    public void removeNgramDynamically(final PrevWordsInfo prevWordsInfo, final String word) {
         reloadDictionaryIfRequired();
         asyncExecuteTaskWithWriteLock(new Runnable() {
             @Override
@@ -343,7 +345,12 @@
                     return;
                 }
                 runGCIfRequiredLocked(true /* mindsBlockByGC */);
-                mBinaryDictionary.removeNgramEntry(prevWordsInfo, word1);
+                if (!mBinaryDictionary.removeNgramEntry(prevWordsInfo, word)) {
+                    if (DEBUG) {
+                        Log.i(TAG, "Cannot remove n-gram entry.");
+                        Log.i(TAG, "  PrevWordsInfo: " + prevWordsInfo + ", word: " + word);
+                    }
+                }
             }
         });
     }
diff --git a/java/src/com/android/inputmethod/latin/utils/StringUtils.java b/java/src/com/android/inputmethod/latin/utils/StringUtils.java
index 4ed0f0a..e4237a7 100644
--- a/java/src/com/android/inputmethod/latin/utils/StringUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/StringUtils.java
@@ -315,24 +315,6 @@
         return true;
     }
 
-    /**
-     * Returns true if all code points in text are whitespace, false otherwise. Empty is true.
-     */
-    // Interestingly enough, U+00A0 NO-BREAK SPACE and U+200B ZERO-WIDTH SPACE are not considered
-    // whitespace, while EN SPACE, EM SPACE and IDEOGRAPHIC SPACES are.
-    public static boolean containsOnlyWhitespace(final String text) {
-        final int length = text.length();
-        int i = 0;
-        while (i < length) {
-            final int codePoint = text.codePointAt(i);
-            if (!Character.isWhitespace(codePoint)) {
-                return false;
-            }
-            i += Character.charCount(codePoint);
-        }
-        return true;
-    }
-
     public static boolean isIdenticalAfterCapitalizeEachWord(final String text,
             final int[] sortedSeparators) {
         boolean needsCapsNext = true;
diff --git a/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java
index bdc608a..cd9a983 100644
--- a/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java
@@ -285,20 +285,6 @@
         assertTrue(bytesStr.equals(bytesStr2));
     }
 
-    public void testContainsOnlyWhitespace() {
-        assertTrue(StringUtils.containsOnlyWhitespace("   "));
-        assertTrue(StringUtils.containsOnlyWhitespace(""));
-        assertTrue(StringUtils.containsOnlyWhitespace("  \n\t\t"));
-        // U+2002 : EN SPACE
-        // U+2003 : EM SPACE
-        // U+3000 : IDEOGRAPHIC SPACE (commonly "double-width space")
-        assertTrue(StringUtils.containsOnlyWhitespace("\u2002\u2003\u3000"));
-        assertFalse(StringUtils.containsOnlyWhitespace("  a "));
-        assertFalse(StringUtils.containsOnlyWhitespace(". "));
-        assertFalse(StringUtils.containsOnlyWhitespace("."));
-        assertTrue(StringUtils.containsOnlyWhitespace(""));
-    }
-
     public void testJsonUtils() {
         final Object[] objs = new Object[] { 1, "aaa", "bbb", 3 };
         final List<Object> objArray = Arrays.asList(objs);