Author: toad
Date: 2007-11-19 23:16:16 +0000 (Mon, 19 Nov 2007)
New Revision: 15866

Modified:
   trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
Log:
Maybe fix deserialising bookmarks

Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2007-11-19 23:00:52 UTC (rev 15865)
+++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2007-11-19 23:16:16 UTC (rev 15866)
@@ -89,7 +89,7 @@
        }

        public class BookmarkCallback implements StringArrCallback {
-               private final Pattern pattern = 
Pattern.compile("/(.*/)([^/]*)=(.*=)?([A-Z]{3}@.*).*");
+               private final Pattern pattern = 
Pattern.compile("/(.*/)([^/]*)=([A-Z]{3}@.*).*");

                public String[] get() {
                        synchronized (BookmarkManager.this) {
@@ -106,19 +106,19 @@
                                 // FIXME: remove
                                 if (matcher.matches() && matcher.groupCount() 
== 3) {

+                                       boolean hasAnActiveLink = false;
                                     makeParents(matcher.group(1));
                                     key = new FreenetURI(matcher.group(3));
+                                    String title = matcher.group(2);
+                                    if(title.endsWith("=|")) {
+                                       title = title.substring(0, 
title.length()-2);
+                                       hasAnActiveLink = true;
+                                    } else if(title.endsWith("=")) {
+                                       title = title.substring(0, 
title.length()-1);
+                                    }
                                     addBookmark(matcher.group(1), new 
BookmarkItem(key,
-                                            matcher.group(2), false, 
node.alerts), false);
+                                            title, hasAnActiveLink, 
node.alerts), false);

-                                } else if (matcher.matches() && 
matcher.groupCount() == 4) {
-
-                                    makeParents(matcher.group(1));
-                                    boolean hasAnActiveLink = 
"|=".equals(matcher.group(3));
-                                    key = new FreenetURI(matcher.group(4));
-                                    addBookmark(matcher.group(1), new 
BookmarkItem(key,
-                                            matcher.group(2), hasAnActiveLink, 
node.alerts), false);
-
                                 } else {
                                     throw new 
InvalidConfigValueException(l10n("malformedBookmark"));
                                 }


Reply via email to