enforce NonNull on incoming MMS content location
Fixes #2959 Closes #2975 // FREEBIE
This commit is contained in:
parent
4a9028aedd
commit
a28408b29f
4 changed files with 22 additions and 10 deletions
|
@ -77,6 +77,11 @@ public class MmsDownloadJob extends MasterSecretJob {
|
|||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (notification.get().getContentLocation() == null) {
|
||||
throw new MmsException("Notification content location was null.");
|
||||
}
|
||||
|
||||
database.markDownloadState(messageId, MmsDatabase.Status.DOWNLOAD_CONNECTING);
|
||||
|
||||
String contentLocation = new String(notification.get().getContentLocation());
|
||||
|
@ -84,7 +89,6 @@ public class MmsDownloadJob extends MasterSecretJob {
|
|||
|
||||
Log.w(TAG, "Downloading mms at " + Uri.parse(contentLocation).getHost());
|
||||
|
||||
try {
|
||||
RetrieveConf retrieveConf = getMmsConnection(context).retrieve(contentLocation, transactionId);
|
||||
if (retrieveConf == null) {
|
||||
throw new MmsException("RetrieveConf was null");
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.thoughtcrime.securesms.mms;
|
|||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
|
@ -58,7 +59,10 @@ public class IncomingLegacyMmsConnection extends LegacyMmsConnection implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public @Nullable RetrieveConf retrieve(String contentLocation, byte[] transactionId) throws MmsRadioException, ApnUnavailableException, IOException {
|
||||
public @Nullable RetrieveConf retrieve(@NonNull String contentLocation,
|
||||
byte[] transactionId)
|
||||
throws MmsRadioException, ApnUnavailableException, IOException
|
||||
{
|
||||
MmsRadio radio = MmsRadio.getInstance(context);
|
||||
Apn contentApn = new Apn(contentLocation, apn.getProxy(), Integer.toString(apn.getPort()), apn.getUsername(), apn.getPassword());
|
||||
if (isCdmaDevice()) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.telephony.SmsManager;
|
||||
import android.util.Log;
|
||||
|
@ -56,7 +57,9 @@ public class IncomingLollipopMmsConnection extends LollipopMmsConnection impleme
|
|||
|
||||
@Override
|
||||
@TargetApi(VERSION_CODES.LOLLIPOP)
|
||||
public synchronized @Nullable RetrieveConf retrieve(String contentLocation, byte[] transactionId) throws MmsException {
|
||||
public synchronized @Nullable RetrieveConf retrieve(@NonNull String contentLocation,
|
||||
byte[] transactionId) throws MmsException
|
||||
{
|
||||
beginTransaction();
|
||||
|
||||
try {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.thoughtcrime.securesms.mms;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -8,5 +9,5 @@ import ws.com.google.android.mms.MmsException;
|
|||
import ws.com.google.android.mms.pdu.RetrieveConf;
|
||||
|
||||
public interface IncomingMmsConnection {
|
||||
@Nullable RetrieveConf retrieve(String contentLocation, byte[] transactionId) throws MmsException, MmsRadioException, ApnUnavailableException, IOException;
|
||||
@Nullable RetrieveConf retrieve(@NonNull String contentLocation, byte[] transactionId) throws MmsException, MmsRadioException, ApnUnavailableException, IOException;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue