Sometimes querying the APN DB throws this exception as well.

This commit is contained in:
Moxie Marlinspike 2013-02-26 22:55:23 -08:00
parent 2397176d9e
commit 6bd0f35787
2 changed files with 6 additions and 2 deletions

View File

@ -29,6 +29,7 @@ import org.thoughtcrime.securesms.recipients.RecipientFactory;
import org.thoughtcrime.securesms.recipients.RecipientFormattingException; import org.thoughtcrime.securesms.recipients.RecipientFormattingException;
import org.thoughtcrime.securesms.recipients.Recipients; import org.thoughtcrime.securesms.recipients.Recipients;
import org.thoughtcrime.securesms.util.Trimmer; 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.InvalidHeaderValueException;
import ws.com.google.android.mms.MmsException; import ws.com.google.android.mms.MmsException;
@ -469,8 +470,8 @@ public class MmsDatabase extends Database {
public Cursor getCarrierMmsInformation(String apn) { public Cursor getCarrierMmsInformation(String apn) {
Uri uri = Uri.withAppendedPath(Uri.parse("content://telephony/carriers"), "current"); Uri uri = Uri.withAppendedPath(Uri.parse("content://telephony/carriers"), "current");
String selection = (apn == null || apn.trim().length() == 0) ? null : "apn = ?"; String selection = Util.isEmpty(apn) ? null : "apn = ?";
String[] selectionArgs = (apn == null || apn.trim().length() == 0) ? null : new String[] {apn.trim()}; String[] selectionArgs = Util.isEmpty(apn) ? null : new String[] {apn.trim()};
return context.getContentResolver().query(uri, null, selection, selectionArgs, null); return context.getContentResolver().query(uri, null, selection, selectionArgs, null);
} }

View File

@ -97,6 +97,9 @@ public class MmsCommunication {
} catch (SecurityException se) { } catch (SecurityException se) {
Log.w("MmsCommunication", se); Log.w("MmsCommunication", se);
return getLocallyConfiguredMmsConnectionParameters(context); return getLocallyConfiguredMmsConnectionParameters(context);
} catch (IllegalArgumentException iae) {
Log.w("MmsCommunication", iae);
return getLocallyConfiguredMmsConnectionParameters(context);
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();