diff options
author | 2013-09-20 04:01:42 -0700 | |
---|---|---|
committer | 2013-09-20 04:01:42 -0700 | |
commit | 564e29d9fe8e256ae01225790f411f0f4391d779 (patch) | |
tree | 3c8bf8ddbeb78e52e83a91078de0a57e0ecc8c3b /java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java | |
parent | 2e10784102868aaccdb91e1822e386a379da3286 (diff) | |
parent | 262b867200fa4ce6b17e05808e0f766a4fbe4f9a (diff) | |
download | latinime-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/ContactsBinaryDictionary.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java index 67eb7f3dd..ffeb92784 100644 --- a/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java @@ -22,6 +22,7 @@ import android.content.ContentResolver; import android.content.Context; import android.database.ContentObserver; import android.database.Cursor; +import android.database.sqlite.SQLiteException; import android.net.Uri; import android.os.SystemClock; import android.provider.BaseColumns; @@ -145,8 +146,10 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary { cursor.close(); } } - } catch (IllegalStateException e) { - Log.e(TAG, "Contacts DB is having problems"); + } catch (final SQLiteException e) { + Log.e(TAG, "SQLiteException in the remote Contacts process.", e); + } catch (final IllegalStateException e) { + Log.e(TAG, "Contacts DB is having problems", e); } } @@ -173,14 +176,18 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary { private int getContactCount() { // TODO: consider switching to a rawQuery("select count(*)...") on the database if // performance is a bottleneck. - final Cursor cursor = mContext.getContentResolver().query( - Contacts.CONTENT_URI, PROJECTION_ID_ONLY, null, null, null); - if (cursor != null) { - try { - return cursor.getCount(); - } finally { - cursor.close(); + try { + final Cursor cursor = mContext.getContentResolver().query( + Contacts.CONTENT_URI, PROJECTION_ID_ONLY, null, null, null); + if (cursor != null) { + try { + return cursor.getCount(); + } finally { + cursor.close(); + } } + } catch (final SQLiteException e) { + Log.e(TAG, "SQLiteException in the remote Contacts process.", e); } return 0; } |