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()); _groups.add(gtok.nextToken().trim());
s = tok.nextToken(); // skip past the : s = tok.nextToken(); // skip past the :
} }
if (tok.hasMoreTokens()) { while (tok.hasMoreTokens()) {
s = tok.nextToken(); if (_location == null)
if (":".equals(s)) { _location = tok.nextToken();
_location = null; else
} else { _location = _location + tok.nextToken();
_location = s;
}
} else {
_location = null;
} }
} }
@@ -161,15 +157,16 @@ public class PetName {
} }
public static void main(String args[]) { public static void main(String args[]) {
test("a:b:c:d:e:f"); test("a:b:c:true:e:f");
test("a:::::d"); test("a:::true::d");
test("a:::::"); test("a:::true::");
test("a:b::::"); test("a:b::true::");
test(":::::"); test(":::trye::");
test("a:b:c:true:e:http://foo.bar");
} }
private static void test(String line) { private static void test(String line) {
PetName pn = new PetName(line); PetName pn = new PetName(line);
String val = pn.toString(); 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 PetNameDB getPetNameDB() { return _petnames; }
public void invalidate() { public void invalidate() {
BlogManager.instance().saveUser(this); if (_authenticated)
BlogManager.instance().saveUser(this);
init(); init();
} }