use Proxy.NO_PROXY instead of null value for no proxy

This commit is contained in:
Vincent Breitmoser
2015-10-29 15:43:16 +01:00
parent 64a09a8945
commit a665dd60fb
7 changed files with 27 additions and 22 deletions

View File

@@ -133,7 +133,7 @@ public class ImportOperation extends BaseOperation<ImportKeyringParcel> {
@NonNull
private ImportKeyResult serialKeyRingImport(Iterator<ParcelableKeyRing> entries, int num,
String keyServerUri, Progressable progressable,
Proxy proxy) {
@NonNull Proxy proxy) {
if (progressable != null) {
progressable.setProgress(R.string.progress_importing, 0, 100);
}
@@ -197,8 +197,7 @@ public class ImportOperation extends BaseOperation<ImportKeyringParcel> {
if (entry.mExpectedFingerprint != null) {
log.add(LogType.MSG_IMPORT_FETCH_KEYSERVER, 2, "0x" +
entry.mExpectedFingerprint.substring(24));
data = keyServer.get("0x" + entry.mExpectedFingerprint, proxy)
.getBytes();
data = keyServer.get("0x" + entry.mExpectedFingerprint, proxy).getBytes();
} else {
log.add(LogType.MSG_IMPORT_FETCH_KEYSERVER, 2, entry.mKeyIdHex);
data = keyServer.get(entry.mKeyIdHex, proxy).getBytes();
@@ -400,8 +399,7 @@ public class ImportOperation extends BaseOperation<ImportKeyringParcel> {
return new ImportKeyResult(null,
RequiredInputParcel.createOrbotRequiredOperation(), cryptoInput);
}
proxy = Preferences.getPreferences(mContext).getProxyPrefs().parcelableProxy
.getProxy();
proxy = Preferences.getPreferences(mContext).getProxyPrefs().getProxy();
} else {
proxy = cryptoInput.getParcelableProxy().getProxy();
}
@@ -444,8 +442,7 @@ public class ImportOperation extends BaseOperation<ImportKeyringParcel> {
ArrayList<ParcelableKeyRing> list = new ArrayList<>();
list.add(pkRing);
return serialKeyRingImport(list.iterator(), 1, keyServer,
ignoreProgressable, proxy);
return serialKeyRingImport(list.iterator(), 1, keyServer, ignoreProgressable, proxy);
}
};

View File

@@ -95,10 +95,10 @@ public class UploadOperation extends BaseOperation<UploadKeyringParcel> {
if (proxyIsTor) {
log.add(LogType.MSG_UPLOAD_PROXY_TOR, 1);
} else if (proxy != null && proxy != Proxy.NO_PROXY) {
log.add(LogType.MSG_UPLOAD_PROXY, 1, proxy.toString());
} else {
} else if (proxy == Proxy.NO_PROXY) {
log.add(LogType.MSG_UPLOAD_PROXY_DIRECT, 1);
} else {
log.add(LogType.MSG_UPLOAD_PROXY, 1, proxy.toString());
}
}