Browse Source

Fix for #255) Whitespace around IP/hostname results in connection error

pull/256/head
Johan Deckmar 9 years ago
parent
commit
a8f7051eb6
  1. 14
      app/src/main/java/org/transdroid/core/app/settings/ApplicationSettings.java

14
app/src/main/java/org/transdroid/core/app/settings/ApplicationSettings.java

@ -165,8 +165,8 @@ public class ApplicationSettings {
return new ServerSetting(order, return new ServerSetting(order,
prefs.getString("server_name_" + order, null), prefs.getString("server_name_" + order, null),
type, type,
prefs.getString("server_address_" + order, null), trim(prefs.getString("server_address_" + order, null)),
prefs.getString("server_localaddress_" + order, null), trim(prefs.getString("server_localaddress_" + order, null)),
Integer.parseInt(localPort), Integer.parseInt(localPort),
prefs.getString("server_localnetwork_" + order, null), prefs.getString("server_localnetwork_" + order, null),
Integer.parseInt(port), Integer.parseInt(port),
@ -719,4 +719,14 @@ public class ApplicationSettings {
edit.apply(); edit.apply();
} }
/**
* Trims away whitespace around a string, or returns null if str is null
* @param str The string to trim, or null
* @return The trimmed string, or null if str is null
*/
private String trim(String str) {
if (str == null) return null;
return str.trim();
}
} }

Loading…
Cancel
Save