aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-09-20 04:01:42 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-09-20 04:01:42 -0700
commit564e29d9fe8e256ae01225790f411f0f4391d779 (patch)
tree3c8bf8ddbeb78e52e83a91078de0a57e0ecc8c3b /java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
parent2e10784102868aaccdb91e1822e386a379da3286 (diff)
parent262b867200fa4ce6b17e05808e0f766a4fbe4f9a (diff)
downloadlatinime-564e29d9fe8e256ae01225790f411f0f4391d779.tar.gz
latinime-564e29d9fe8e256ae01225790f411f0f4391d779.tar.xz
latinime-564e29d9fe8e256ae01225790f411f0f4391d779.zip
am 262b8672: Merge "Catch SQLiteException from remote processes"
* commit '262b867200fa4ce6b17e05808e0f766a4fbe4f9a': Catch SQLiteException from remote processes
Diffstat (limited to '')
-rw-r--r--java/src/com/android/inputmethod/latin/UserBinaryDictionary.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java b/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
index a241b5505..864a17375 100644
--- a/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
@@ -22,10 +22,12 @@ import android.content.ContentUris;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
+import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.os.Build;
import android.provider.UserDictionary.Words;
import android.text.TextUtils;
+import android.util.Log;
import com.android.inputmethod.compat.UserDictionaryCompatUtils;
import com.android.inputmethod.latin.utils.LocaleUtils;
@@ -39,6 +41,7 @@ import java.util.Locale;
* dictionary file to use it from native code.
*/
public class UserBinaryDictionary extends ExpandableBinaryDictionary {
+ private static final String TAG = ExpandableBinaryDictionary.class.getSimpleName();
// The user dictionary provider uses an empty string to mean "all languages".
private static final String USER_DICTIONARY_ALL_LANGUAGES = "";
@@ -168,12 +171,19 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
} else {
requestArguments = localeElements;
}
- final Cursor cursor = mContext.getContentResolver().query(
- Words.CONTENT_URI, PROJECTION_QUERY, request.toString(), requestArguments, null);
+ Cursor cursor = null;
try {
+ cursor = mContext.getContentResolver().query(
+ Words.CONTENT_URI, PROJECTION_QUERY, request.toString(), requestArguments, null);
addWords(cursor);
+ } catch (final SQLiteException e) {
+ Log.e(TAG, "SQLiteException in the remote User dictionary process.", e);
} finally {
- if (null != cursor) cursor.close();
+ try {
+ if (null != cursor) cursor.close();
+ } catch (final SQLiteException e) {
+ Log.e(TAG, "SQLiteException in the remote User dictionary process.", e);
+ }
}
}