diff options
author | Roshan Pius <rpius@google.com> | 2015-07-13 12:57:40 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2015-07-14 11:20:42 -0700 |
commit | 93018a4d983f0c7063fd0b243436364cd191e0a9 (patch) | |
tree | 50f3a7acb3bda98e843adf0631985fc77daaa0ca /telephony/java/android | |
parent | 7e9cb0d094043bd8bdb7544c2356abd5479b7aee (diff) | |
download | frameworks_base-93018a4d983f0c7063fd0b243436364cd191e0a9.zip frameworks_base-93018a4d983f0c7063fd0b243436364cd191e0a9.tar.gz frameworks_base-93018a4d983f0c7063fd0b243436364cd191e0a9.tar.bz2 |
Handle exceptions when accessing Content providers.
BUG: 21638129
Change-Id: I88f7dcf67e395f49136a1f434fbd9c75e15cddad
Diffstat (limited to 'telephony/java/android')
-rw-r--r-- | telephony/java/android/telephony/PhoneNumberUtils.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index d18b86a..79146f3 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -177,15 +177,19 @@ public class PhoneNumberUtils phoneColumn = ContactsContract.CommonDataKinds.Phone.NUMBER; } - final Cursor c = context.getContentResolver().query(uri, new String[] { - phoneColumn - }, null, null, null); - if (c != null) { - try { + Cursor c = null; + try { + c = context.getContentResolver().query(uri, new String[] { phoneColumn }, + null, null, null); + if (c != null) { if (c.moveToFirst()) { number = c.getString(c.getColumnIndex(phoneColumn)); } - } finally { + } + } catch (RuntimeException e) { + Rlog.e(LOG_TAG, "Error getting phone number.", e); + } finally { + if (c != null) { c.close(); } } |