1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

1) Escape values in form field to prevent error.

2) Check for null value in error type to handle invalid error types.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@5737 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro 2006-10-17 13:15:35 +00:00 committed by derek
parent 43744eb09f
commit d4147e012b
3 changed files with 44 additions and 41 deletions

View file

@ -47,7 +47,7 @@ public class StringUtils {
if (XMPPAddress == null) {
return null;
}
int atIndex = XMPPAddress.indexOf("@");
int atIndex = XMPPAddress.lastIndexOf("@");
if (atIndex <= 0) {
return "";
}
@ -68,13 +68,13 @@ public class StringUtils {
if (XMPPAddress == null) {
return null;
}
int atIndex = XMPPAddress.indexOf("@");
int atIndex = XMPPAddress.lastIndexOf("@");
// If the String ends with '@', return the empty string.
if (atIndex + 1 > XMPPAddress.length()) {
return "";
}
int slashIndex = XMPPAddress.indexOf("/");
if (slashIndex > 0) {
if (slashIndex > 0 && slashIndex > atIndex) {
return XMPPAddress.substring(atIndex + 1, slashIndex);
}
else {