From 6afc64ac39b169ab93e9e47e3d226f67a7dee410 Mon Sep 17 00:00:00 2001 From: jrandom <jrandom> Date: Mon, 5 Sep 2005 17:09:19 +0000 Subject: [PATCH] deal with locations that have : in them (aka http://glog.i2p/archive/archive.txt) --- .../java/src/net/i2p/syndie/PetName.java | 27 +++++++++---------- apps/syndie/java/src/net/i2p/syndie/User.java | 3 ++- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/apps/syndie/java/src/net/i2p/syndie/PetName.java b/apps/syndie/java/src/net/i2p/syndie/PetName.java index a6c42e9da5..c63d149879 100644 --- a/apps/syndie/java/src/net/i2p/syndie/PetName.java +++ b/apps/syndie/java/src/net/i2p/syndie/PetName.java @@ -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 + "]"); } } diff --git a/apps/syndie/java/src/net/i2p/syndie/User.java b/apps/syndie/java/src/net/i2p/syndie/User.java index b4f435c50c..9bb1279e1a 100644 --- a/apps/syndie/java/src/net/i2p/syndie/User.java +++ b/apps/syndie/java/src/net/i2p/syndie/User.java @@ -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(); } -- GitLab