From dd6fd2532c8ca5f00ad754e30383cd61566462ca Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Mon, 6 Jan 2014 14:14:38 -0600 Subject: [PATCH] Issue #2563 modified server config parsing to allow for custom port Replaced parsing code that assumed no colon in the server name, which prevented connecting to servers that didn't use the default XMPP port. Former-commit-id: 4f2aa498078ca60e1b47e7783e456e67a71e9277 [formerly cea12a1a1d0628b564c276fdea7f78b035ef7f1f] [formerly 4f2aa498078ca60e1b47e7783e456e67a71e9277 [formerly cea12a1a1d0628b564c276fdea7f78b035ef7f1f] [formerly b01e6f0c980dee60e2ef959668d3c538741d4b46 [formerly b995fe2036d4c0e26e25edd7f4bffd956d82921f]]] Former-commit-id: b01e6f0c980dee60e2ef959668d3c538741d4b46 Former-commit-id: 74c6fdc613c66e75f88c9aba23922915edfe2000 [formerly d64d95d0c6aa6dbd50e1da3bb709879072120a5e] Former-commit-id: 37be43af825ada31e3841cf40fc8b29781de835a --- .../viz/collaboration/ui/login/LoginDialog.java | 4 +++- .../viz/collaboration/ui/login/ServerInput.java | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/LoginDialog.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/LoginDialog.java index 2e4ca79fb0..e597e116a9 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/LoginDialog.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/LoginDialog.java @@ -66,6 +66,7 @@ import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants; * ------------ ---------- ----------- -------------------------- * Jun 18, 2012 mschenke Initial creation * Dec 19, 2013 2563 bclement added option to connect to server not in list + * Jan 06, 2014 2563 bclement moved server text parsing to ServerInput class * * * @@ -289,7 +290,8 @@ public class LoginDialog extends Dialog { public void widgetSelected(SelectionEvent event) { loginData.setUserName(userText.getText().trim()); loginData.setPassword(passwordText.getText().trim()); - loginData.setServer(serverText.getText().split(":")[1].trim()); + loginData.setServer(ServerInput.removeDescription(serverText + .getText())); loginData.setStatus(statusCombo.getText()); loginData.setMessage(messageText.getText().trim()); Map attributes = new HashMap(); diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/ServerInput.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/ServerInput.java index 4590064ff2..2ee9d9850f 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/ServerInput.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/ServerInput.java @@ -47,6 +47,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Dec 18, 2013 2563 bclement Initial creation + * Jan 06, 2014 2563 bclement added removeDescription * * * @@ -64,7 +65,6 @@ public class ServerInput implements Listener { private static final int TIMEOUT = 5000; // 5 seconds - /** * @param serverText */ @@ -158,4 +158,18 @@ public class ServerInput implements Listener { } } + /** + * Remove server description from server text field + * + * @param text + * @return + */ + public static String removeDescription(String text) { + int firstColon = text.indexOf(':'); + if (firstColon >= 0) { + text = text.substring(firstColon + 1); + } + return text.trim(); + } + }