deal with locations that have : in them (aka http://glog.i2p/archive/archive.txt)

This commit is contained in:
jrandom
2005-09-05 17:09:19 +00:00
committed by zzz
parent 61b8e3598b
commit 6afc64ac39
2 changed files with 14 additions and 16 deletions

View File

@ -76,15 +76,11 @@ public class PetName {
_groups.add(gtok.nextToken().trim());
s = tok.nextToken(); // skip past the :
}
if (tok.hasMoreTokens()) {
s = tok.nextToken();
if (":".equals(s)) {
_location = null;
} else {
_location = s;
}
} else {
_location = null;
while (tok.hasMoreTokens()) {
if (_location == null)
_location = tok.nextToken();
else
_location = _location + tok.nextToken();
}
}
@ -161,15 +157,16 @@ public class PetName {
}
public static void main(String args[]) {
test("a:b:c:d:e:f");
test("a:::::d");
test("a:::::");
test("a:b::::");
test(":::::");
test("a:b:c:true:e:f");
test("a:::true::d");
test("a:::true::");
test("a:b::true::");
test(":::trye::");
test("a:b:c:true:e:http://foo.bar");
}
private static void test(String line) {
PetName pn = new PetName(line);
String val = pn.toString();
System.out.println("OK? " + val.equals(line) + ": " + line);
System.out.println("OK? " + val.equals(line) + ": " + line + " [" + val + "]");
}
}

View File

@ -98,7 +98,8 @@ public class User {
public PetNameDB getPetNameDB() { return _petnames; }
public void invalidate() {
BlogManager.instance().saveUser(this);
if (_authenticated)
BlogManager.instance().saveUser(this);
init();
}