summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2017-11-03 15:17:45 +0100
committercyBerta <cyberta@riseup.net>2017-11-03 15:17:45 +0100
commit859c2b4496618c8142c70610ebba395e9aa4d5dc (patch)
tree137fd4af0292e8b8a8abb26307f82c580f485a0f /app/src/main/java/se/leap
parent719c63ee33a88b239e96efead8da14cf985ca9aa (diff)
#8778 fixes invalid provider error handling
Diffstat (limited to 'app/src/main/java/se/leap')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java11
2 files changed, 12 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java
index 4929f040..33b2e225 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java
@@ -47,7 +47,7 @@ public class ConfigHelper {
} else {
return false;
}
- } catch (JSONException e) {
+ } catch (NullPointerException | JSONException e) {
return false;
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java b/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java
index caa48231..bf1c3941 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java
@@ -687,6 +687,17 @@ public abstract class ProviderApiBase extends IntentService {
return CA_CERT_DOWNLOADED;
}
+ protected boolean isValidJson(String jsonString) {
+ try {
+ new JSONObject(jsonString);
+ return true;
+ } catch(JSONException e) {
+ return false;
+ } catch(NullPointerException e) {
+ return false;
+ }
+ }
+
protected boolean validCertificate(String cert_string) {
boolean result = false;
if (!ConfigHelper.checkErroneousDownload(cert_string)) {