use Proxy.NO_PROXY instead of null value for no proxy
This commit is contained in:
@@ -17,13 +17,14 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.util;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* used to simply transport java.net.Proxy objects created using InetSockets between services/activities
|
||||
*/
|
||||
@@ -48,10 +49,10 @@ public class ParcelableProxy implements Parcelable {
|
||||
return new ParcelableProxy(null, -1, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
public Proxy getProxy() {
|
||||
if (mProxyHost == null) {
|
||||
return null;
|
||||
return Proxy.NO_PROXY;
|
||||
}
|
||||
/*
|
||||
* InetSocketAddress.createUnresolved so we can use this method even in the main thread
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.content.SharedPreferences;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
@@ -325,6 +326,7 @@ public class Preferences {
|
||||
else this.parcelableProxy = new ParcelableProxy(hostName, port, type);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Proxy getProxy() {
|
||||
return parcelableProxy.getProxy();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user