summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2026-03-16 02:29:23 +0100
committercyberta <cyberta@riseup.net>2026-03-16 11:08:57 +0000
commit260938aa3aa599dea91aff1f611b73ab23fd9d01 (patch)
tree450edb6c79f2ca93029bb71a8868fc74ac845945
parent69130f05d3172cd0b895db44c898eaae1ffe3c93 (diff)
fix timezone parsing for positive timezones
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java4
2 files changed, 5 insertions, 5 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
index 783f9124..b207d6e8 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
@@ -90,12 +90,12 @@ public class Gateway {
* and create a VpnProfile belonging to it.
*/
public Gateway(JSONObject eipDefinition, JSONObject secrets, JSONObject gateway)
- throws ConfigParser.ConfigParseError, JSONException, IOException {
+ throws ConfigParser.ConfigParseError, JSONException, IOException, NumberFormatException {
this(eipDefinition, secrets, gateway, null);
}
public Gateway(JSONObject eipDefinition, JSONObject secrets, JSONObject gateway, JSONObject load)
- throws ConfigParser.ConfigParseError, JSONException, IOException {
+ throws ConfigParser.ConfigParseError, JSONException, IOException, NumberFormatException {
this.gateway = gateway;
this.secrets = secrets;
@@ -106,7 +106,7 @@ public class Gateway {
this.host = gateway.optString(HOST);
JSONObject location = getLocationInfo(gateway, eipDefinition);
this.locationName = location.optString(NAME);
- this.timezone = location.optInt(TIMEZONE);
+ this.timezone = Integer.parseInt(location.optString(TIMEZONE));
VpnConfigGenerator.Configuration configuration = getProfileConfig(Transport.createTransportsFrom(gateway, apiVersion));
this.generalConfiguration = getGeneralConfiguration(eipDefinition);
this.name = configuration.profileName;
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
index b207fb14..ba9dc769 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -454,7 +454,7 @@ public class GatewaysManager {
), null, PINNED_OBFUSCATION_PROXY, capabilities);
Gateway gateway = new Gateway(eipDefinition, secrets, new JSONObject(gatewayJson.toString()));
addGateway(gateway);
- } catch (JSONException | ConfigParser.ConfigParseError | IOException e) {
+ } catch (JSONException | ConfigParser.ConfigParseError | IOException | NumberFormatException e) {
e.printStackTrace();
}
} else {
@@ -465,7 +465,7 @@ public class GatewaysManager {
if (gateways.get(aux.getHost()) == null) {
addGateway(aux);
}
- } catch (JSONException | IOException e) {
+ } catch (JSONException | IOException | NumberFormatException e) {
e.printStackTrace();
VpnStatus.logError("Unable to parse gateway config!");
} catch (ConfigParser.ConfigParseError e) {