summaryrefslogtreecommitdiff
path: root/app/src/insecure/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/insecure/java')
-rw-r--r--app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
index dfc98ffb..d57dfe6d 100644
--- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
+++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
@@ -171,9 +171,15 @@ public class ProviderApiManager extends ProviderApiManagerBase {
eipServiceJsonString = downloadWithProviderCA(provider.getCaCert(), eipServiceUrl, lastDangerOn);
JSONObject eipServiceJson = new JSONObject(eipServiceJsonString);
- provider.setEipServiceJson(eipServiceJson);
- result.putBoolean(BROADCAST_RESULT_KEY, true);
+ if (eipServiceJson.has(ERRORS)) {
+ String reasonToFail = pickErrorMessage(eipServiceJsonString);
+ result.putString(ERRORS, reasonToFail);
+ result.putBoolean(BROADCAST_RESULT_KEY, false);
+ } else{
+ provider.setEipServiceJson(eipServiceJson);
+ result.putBoolean(BROADCAST_RESULT_KEY, true);
+ }
} catch (NullPointerException | JSONException e) {
String reasonToFail = pickErrorMessage(eipServiceJsonString);
result.putString(ERRORS, reasonToFail);
@@ -201,7 +207,7 @@ public class ProviderApiManager extends ProviderApiManagerBase {
if (certString == null || certString.isEmpty() || ConfigHelper.checkErroneousDownload(certString))
return false;
else
- return loadCertificate(certString);
+ return loadCertificate(provider, certString);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();