summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2017-11-09 10:32:45 -0800
committercyberta <cyberta@riseup.net>2017-11-09 10:32:45 -0800
commitf6e7474c37bd2ee65b290474f5ea601082ca7eb4 (patch)
tree91a8b79da9aa1ed5bf84d1890721e346609f1048 /app/src/main
parentbd49ce4456af6b71ef8aea96d58aae5baaab069a (diff)
parent859c2b4496618c8142c70610ebba395e9aa4d5dc (diff)
Merge branch '8778_invalid_provider_error_handling' into 'master'
#8778 fixes invalid provider error handling See merge request leap/bitmask_android!15
Diffstat (limited to 'app/src/main')
-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)) {