diff options
author | cyBerta <cyberta@riseup.net> | 2024-12-03 02:02:07 +0100 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2024-12-11 00:09:34 +0000 |
commit | 087f0093593650e647ced850ac8596c917e51e33 (patch) | |
tree | 2b0bf0c1cfa4c7ef97a96e7a9e6fd465dee32ec1 /app/src | |
parent | d7483bc9d1811b122673ec09e58b1ce74955e6c2 (diff) |
catch possible exceptions when trying to set base country in bitmask-core
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java index 4b30b792..d478c08e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java @@ -104,7 +104,11 @@ public class ProviderApiManagerV5 extends ProviderApiManagerBase implements IPro return eventSender.setErrorResult(currentDownload, R.string.config_error_found, null); } - configureBaseCountryCode(bm, parameters); + try { + configureBaseCountryCode(bm, parameters); + } catch (Exception e) { + return eventSender.setErrorResult(currentDownload, R.string.config_error_found, null); + } try { String serviceJson = bm.getService(); @@ -159,12 +163,16 @@ public class ProviderApiManagerV5 extends ProviderApiManagerBase implements IPro bm.setSocksProxy(SOCKS_PROXY_SCHEME + PROXY_HOST + ":" + TorStatusObservable.getSocksProxyPort()); } // TODO bm.setIntroducer(); - } catch (IllegalStateException e) { + } catch (Exception e) { // TODO: improve error message return eventSender.setErrorResult(currentDownload, R.string.config_error_found, null); } - configureBaseCountryCode(bm, parameters); + try { + configureBaseCountryCode(bm, parameters); + } catch (Exception e) { + return eventSender.setErrorResult(currentDownload, R.string.config_error_found, null); + } try { String serviceJson = bm.getService(); @@ -223,13 +231,12 @@ public class ProviderApiManagerV5 extends ProviderApiManagerBase implements IPro } @Nullable - private void configureBaseCountryCode(BitmaskMobile bm, Bundle parameters) { + private void configureBaseCountryCode(BitmaskMobile bm, Bundle parameters) throws Exception { String cc = parameters.getString(COUNTRYCODE, null); if (cc == null && EipStatus.getInstance().isDisconnected() && TorStatusObservable.getStatus() == OFF) { try { - // FIXME: doGeolocationLookup currently sets the country code implicitly, change that in bitmask-core cc = bm.getGeolocation(); } catch (Exception e) { // print exception and ignore |