diff options
author | cyBerta <cyberta@riseup.net> | 2018-01-10 17:14:45 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2018-01-10 17:14:45 +0100 |
commit | ae8341cf1f563fbcf2bdd6a4eff9525f42e9e995 (patch) | |
tree | 43f7da97aa2d8dd1313fe90a69df93f7b96749f0 /app/src/production/java | |
parent | 0b647ea5e7ff67747080b2ffcebc948da0fbecb5 (diff) |
8773 more test cases and clean-up
Diffstat (limited to 'app/src/production/java')
-rw-r--r-- | app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java index 31c63d01..b20a7759 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java @@ -37,6 +37,7 @@ import static se.leap.bitmaskclient.DownloadFailedDialog.DOWNLOAD_ERRORS.ERROR_C import static se.leap.bitmaskclient.ProviderAPI.ERRORS; import static se.leap.bitmaskclient.ProviderAPI.RESULT_KEY; import static se.leap.bitmaskclient.R.string.malformed_url; +import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_cert; /** * Implements the logic of the provider api http requests. The methods of this class need to be called from @@ -76,7 +77,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { if (isEmpty(lastProviderMainUrl)) { currentDownload.putBoolean(RESULT_KEY, false); - setErrorResult(currentDownload, resources.getString(R.string.malformed_url), null); + setErrorResult(currentDownload, malformed_url, null); return currentDownload; } @@ -150,8 +151,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { } if (!isValidJson(providerDotJsonString)) { - result.putString(ERRORS, resources.getString(malformed_url)); - result.putBoolean(RESULT_KEY, false); + setErrorResult(result, malformed_url, null); return result; } @@ -247,12 +247,10 @@ public class ProviderApiManager extends ProviderApiManagerBase { preferences.edit().putString(Provider.CA_CERT + "." + providerDomain, cert_string).commit(); result.putBoolean(RESULT_KEY, true); } else { - setErrorResult(result, resources.getString(R.string.warning_corrupted_provider_cert), ERROR_CERTIFICATE_PINNING.toString()); - result.putBoolean(RESULT_KEY, false); + setErrorResult(result, warning_corrupted_provider_cert, ERROR_CERTIFICATE_PINNING.toString()); } } catch (JSONException e) { - setErrorResult(result, resources.getString(malformed_url), null); - result.putBoolean(RESULT_KEY, false); + setErrorResult(result, malformed_url, null); } return result; |