From 37b56c93705c32794da6fdd4a177d4bea9e26408 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Wed, 28 Jan 2004 21:30:13 +0000 Subject: [PATCH] Small fixes. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2218 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/util/StringUtils.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/org/jivesoftware/smack/util/StringUtils.java b/source/org/jivesoftware/smack/util/StringUtils.java index 78c9cd438..f578df74e 100644 --- a/source/org/jivesoftware/smack/util/StringUtils.java +++ b/source/org/jivesoftware/smack/util/StringUtils.java @@ -89,12 +89,12 @@ public class StringUtils { } /** - * Returns the name portion of a XMPP address. For example, for the + * Returns the server portion of a XMPP address. For example, for the * address "matt@jivesoftware.com/Smack", "jivesoftware.com" would be returned. * If no server is present in the address, the empty string will be returned. * * @param XMPPAddress the XMPP address. - * @return the resource portion of the XMPP address. + * @return the server portion of the XMPP address. */ public static String parseServer(String XMPPAddress) { if (XMPPAddress == null) { @@ -105,6 +105,9 @@ public class StringUtils { if (atIndex + 1 > XMPPAddress.length()) { return ""; } + if (atIndex < 0) { + atIndex = 0; + } int slashIndex = XMPPAddress.indexOf("/"); if (slashIndex > 0) { return XMPPAddress.substring(atIndex + 1, slashIndex); @@ -115,7 +118,7 @@ public class StringUtils { } /** - * Returns the name portion of a XMPP address. For example, for the + * Returns the resource portion of a XMPP address. For example, for the * address "matt@jivesoftware.com/Smack", "Smack" would be returned. If no * resource is present in the address, the empty string will be returned. *