From a665dd60fbf52eccb04980bb040569967a617ebe Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 29 Oct 2015 15:43:16 +0100 Subject: use Proxy.NO_PROXY instead of null value for no proxy --- .../keychain/operations/ImportOperation.java | 11 ++++------- .../keychain/operations/UploadOperation.java | 6 +++--- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java index 89575338f..76223becc 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java @@ -133,7 +133,7 @@ public class ImportOperation extends BaseOperation { @NonNull private ImportKeyResult serialKeyRingImport(Iterator 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 { 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 { 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 { ArrayList list = new ArrayList<>(); list.add(pkRing); - return serialKeyRingImport(list.iterator(), 1, keyServer, - ignoreProgressable, proxy); + return serialKeyRingImport(list.iterator(), 1, keyServer, ignoreProgressable, proxy); } }; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java index d4bbaa9fd..836894f59 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java @@ -95,10 +95,10 @@ public class UploadOperation extends BaseOperation { 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()); } } -- cgit v1.2.3