Fix for IllegalArgumentException with null URL host.

fork-5.53.8
Moxie Marlinspike 2013-05-06 19:45:05 -07:00
rodzic ff41c6763d
commit 43214a854c
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -28,6 +28,7 @@ import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.thoughtcrime.securesms.service.MmscProcessor;
import org.thoughtcrime.securesms.util.Util;
import ws.com.google.android.mms.pdu.PduParser;
import ws.com.google.android.mms.pdu.SendConf;
@ -45,6 +46,10 @@ public class MmsSendHelper extends MmsCommunication {
Log.w("MmsSender", "Sending MMS1 of length: " + (mms != null ? mms.length : "null"));
client = constructHttpClient(context, parameters);
URI targetUrl = new URI(parameters.getMmsc());
if (Util.isEmpty(targetUrl.getHost()))
throw new IOException("Invalid target host: " + targetUrl.getHost() + " , " + targetUrl);
HttpHost target = new HttpHost(targetUrl.getHost(), targetUrl.getPort(), HttpHost.DEFAULT_SCHEME_NAME);
HttpPost request = new HttpPost(parameters.getMmsc());
ByteArrayEntity entity = new ByteArrayEntity(mms);