Browse Source

Merge pull request #14 from tombriden/blank_port_fix

Fix NumberFormatException if port is saved as blank string
pull/13/merge
Eric Kok 11 years ago
parent
commit
11652b7dce
  1. 8
      core/src/org/transdroid/core/app/settings/ApplicationSettings.java

8
core/src/org/transdroid/core/app/settings/ApplicationSettings.java

@ -89,13 +89,17 @@ public class ApplicationSettings {
// @formatter:off // @formatter:off
Daemon type = Daemon.fromCode(prefs.getString("server_type_" + order, null)); Daemon type = Daemon.fromCode(prefs.getString("server_type_" + order, null));
boolean ssl = prefs.getBoolean("server_sslenabled_" + order, false); boolean ssl = prefs.getBoolean("server_sslenabled_" + order, false);
String defaultPort = Integer.toString(Daemon.getDefaultPortNumber(type, ssl));
String port = prefs.getString("server_port_" + order, "");
if(port.equals(""))
port = Integer.toString(Daemon.getDefaultPortNumber(type, ssl));
return new ServerSetting(order, return new ServerSetting(order,
prefs.getString("server_name_" + order, null), type, prefs.getString("server_name_" + order, null), type,
prefs.getString("server_address_" + order, null), prefs.getString("server_address_" + order, null),
prefs.getString("server_localaddress_" + order, null), prefs.getString("server_localaddress_" + order, null),
prefs.getString("server_localnetwork_" + order, null), prefs.getString("server_localnetwork_" + order, null),
Integer.parseInt(prefs.getString("server_port_" + order, defaultPort)), Integer.parseInt(port),
ssl, ssl,
prefs.getBoolean("server_ssltrustall_" + order, false), prefs.getBoolean("server_ssltrustall_" + order, false),
prefs.getString("server_ssltrustkey_" + order, null), prefs.getString("server_ssltrustkey_" + order, null),

Loading…
Cancel
Save