From 6bd0f35787b5004cd22ebb65d8650690d7342025 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Tue, 26 Feb 2013 22:55:23 -0800 Subject: [PATCH] Sometimes querying the APN DB throws this exception as well. --- src/org/thoughtcrime/securesms/database/MmsDatabase.java | 5 +++-- src/org/thoughtcrime/securesms/mms/MmsCommunication.java | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/database/MmsDatabase.java b/src/org/thoughtcrime/securesms/database/MmsDatabase.java index e5acf63976..d1144c59e9 100644 --- a/src/org/thoughtcrime/securesms/database/MmsDatabase.java +++ b/src/org/thoughtcrime/securesms/database/MmsDatabase.java @@ -29,6 +29,7 @@ import org.thoughtcrime.securesms.recipients.RecipientFactory; import org.thoughtcrime.securesms.recipients.RecipientFormattingException; import org.thoughtcrime.securesms.recipients.Recipients; import org.thoughtcrime.securesms.util.Trimmer; +import org.thoughtcrime.securesms.util.Util; import ws.com.google.android.mms.InvalidHeaderValueException; import ws.com.google.android.mms.MmsException; @@ -469,8 +470,8 @@ public class MmsDatabase extends Database { public Cursor getCarrierMmsInformation(String apn) { Uri uri = Uri.withAppendedPath(Uri.parse("content://telephony/carriers"), "current"); - String selection = (apn == null || apn.trim().length() == 0) ? null : "apn = ?"; - String[] selectionArgs = (apn == null || apn.trim().length() == 0) ? null : new String[] {apn.trim()}; + String selection = Util.isEmpty(apn) ? null : "apn = ?"; + String[] selectionArgs = Util.isEmpty(apn) ? null : new String[] {apn.trim()}; return context.getContentResolver().query(uri, null, selection, selectionArgs, null); } diff --git a/src/org/thoughtcrime/securesms/mms/MmsCommunication.java b/src/org/thoughtcrime/securesms/mms/MmsCommunication.java index 4174ff34e0..f1a35e18c6 100644 --- a/src/org/thoughtcrime/securesms/mms/MmsCommunication.java +++ b/src/org/thoughtcrime/securesms/mms/MmsCommunication.java @@ -97,6 +97,9 @@ public class MmsCommunication { } catch (SecurityException se) { Log.w("MmsCommunication", se); return getLocallyConfiguredMmsConnectionParameters(context); + } catch (IllegalArgumentException iae) { + Log.w("MmsCommunication", iae); + return getLocallyConfiguredMmsConnectionParameters(context); } finally { if (cursor != null) cursor.close();