private SipURI getUsableSipUri(AddressTokenizer t, boolean considerSipUris, String uris) {
if (!t.hasMoreTokens()) {
return (considerSipUris == false) ? null : getUsableSipUri(new AddressTokenizer(uris), false, null);
} else {
AddressTokenizer.Token t0 = t.nextToken();
URI u0 = null;
try {
switch (t0.code) {
case 0:
case 1:
u0 = canonicalize(forgivingCreateURI(t0.token));
break;
case 2:
u0 = canonicalize(nameAddrCreateURI(t0.token));
break;
}
} catch (ServletParseException e) {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "multiple URIs, exception when parsing this one: " + t0.token);
}
// Continue with next
return getUsableSipUri(t, considerSipUris, uris);
}
if ((u0 == null) || (u0.isSipURI() && !considerSipUris) || (!u0.isSipURI() && considerSipUris)) {
return getUsableSipUri(t, considerSipUris, uris);
} else {
SipURI su0 = transformURI(u0);
if ((su0 == null) || (su0.getUser() == null) || su0.getUser().equals("")) {