summaryrefslogtreecommitdiffstats
path: root/telephony/java/android
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-07-13 12:57:40 -0700
committerRoshan Pius <rpius@google.com>2015-07-14 11:20:42 -0700
commit93018a4d983f0c7063fd0b243436364cd191e0a9 (patch)
tree50f3a7acb3bda98e843adf0631985fc77daaa0ca /telephony/java/android
parent7e9cb0d094043bd8bdb7544c2356abd5479b7aee (diff)
downloadframeworks_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.java16
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();
}
}