"example.net/@/" should be a valid JID.

Retab JID file
This commit is contained in:
Sam Whited 2014-12-02 10:09:31 -05:00
parent 3fc834c067
commit 4f9dd82457

View File

@ -78,8 +78,15 @@ public final class Jid {
String finaljid;
final int domainpartStart;
if (atCount >= 1) {
final int atLoc = jid.indexOf("@");
final int slashLoc = jid.indexOf("/");
// If there is no "@" in the JID (eg. "example.net" or "example.net/resource")
// or there are one or more "@" signs but they're all in the resourcepart (eg. "example.net/@/rp@"):
if (atCount == 0 || (atCount > 0 && slashLoc != -1 && atLoc > slashLoc)) {
localpart = "";
finaljid = "";
domainpartStart = 0;
} else {
final String lp = jid.substring(0, atLoc);
try {
localpart = Stringprep.nodeprep(lp);
@ -91,15 +98,10 @@ public final class Jid {
}
domainpartStart = atLoc + 1;
finaljid = lp + "@";
} else {
localpart = "";
finaljid = "";
domainpartStart = 0;
}
final String dp;
if (slashCount >= 1) {
final int slashLoc = jid.indexOf("/");
if (slashCount > 0) {
final String rp = jid.substring(slashLoc + 1, jid.length());
try {
resourcepart = Stringprep.resourceprep(rp);