From ae8341cf1f563fbcf2bdd6a4eff9525f42e9e995 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 10 Jan 2018 17:14:45 +0100 Subject: 8773 more test cases and clean-up --- .../java/se/leap/bitmaskclient/ProviderApiManager.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'app/src/production') 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; -- cgit v1.2.3