diff options
author | fupduck <fupduck@riseup.net> | 2018-02-21 09:18:15 -0800 |
---|---|---|
committer | fupduck <fupduck@riseup.net> | 2018-02-21 09:18:15 -0800 |
commit | 420792c833f0ad6ecf55824fd8d9bb5d7eaa2aed (patch) | |
tree | e7c05ee05086f3646e30b1246801070218005e57 /app/src/production | |
parent | d6db9433d9f9e0e2f1dc21cd3de7d88d1e473861 (diff) | |
parent | 339251605b689d6afd4708d851d42d91fd1d3fa5 (diff) |
Merge branch '#8853_error_handling_adding_providers' into '0.9.8'
#8853 error handling adding providers
See merge request leap/bitmask_android!46
Diffstat (limited to 'app/src/production')
-rw-r--r-- | app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java index e5ee6c49..885d69db 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java @@ -34,6 +34,7 @@ import se.leap.bitmaskclient.eip.EIP; import static android.text.TextUtils.isEmpty; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; +import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.ERRORS; import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_CERTIFICATE_PINNING; @@ -84,6 +85,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { //provider details invalid if (currentDownload.containsKey(ERRORS)) { + currentDownload.putParcelable(PROVIDER_KEY, provider); return currentDownload; } @@ -121,7 +123,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { providerDotJsonString = downloadFromApiUrlWithProviderCA("/provider.json", caCert, providerDefinition); } - if (!isValidJson(providerDotJsonString)) { + if (ConfigHelper.checkErroneousDownload(providerDotJsonString) || !isValidJson(providerDotJsonString)) { setErrorResult(result, malformed_url, null); return result; } @@ -177,9 +179,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { protected Bundle updateVpnCertificate(Provider provider) { Bundle result = new Bundle(); try { - JSONObject providerJson = provider.getDefinition(); - String providerMainUrl = providerJson.getString(Provider.API_URL); - URL newCertStringUrl = new URL(providerMainUrl + "/" + providerJson.getString(Provider.API_VERSION) + "/" + PROVIDER_VPN_CERTIFICATE); + URL newCertStringUrl = new URL(provider.getApiUrlWithVersion() + "/" + PROVIDER_VPN_CERTIFICATE); String certString = downloadWithProviderCA(provider.getCaCert(), newCertStringUrl.toString()); if (ConfigHelper.checkErroneousDownload(certString)) { @@ -194,7 +194,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { } } return loadCertificate(provider, certString); - } catch (IOException | JSONException e) { + } catch (IOException e) { // TODO try to get Provider Json setErrorResult(result, downloading_vpn_certificate_failed, null); e.printStackTrace(); |