Author: toad
Date: 2007-11-20 23:56:34 +0000 (Tue, 20 Nov 2007)
New Revision: 15893

Modified:
   trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
Log:
Fix import code, well at least part of it

Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2007-11-20 22:06:13 UTC (rev 15892)
+++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2007-11-20 23:56:34 UTC (rev 15893)
@@ -87,16 +87,22 @@

     private void migrateOldBookmarks(String[] newVals) {
         //FIXME: for some reason that doesn't work... if someone wants to fix 
it ;)
-        Pattern pattern = 
Pattern.compile("/(.*/)([^/]*)=(|=)*([A-Z]{3}@.*).*");
+        Pattern pattern = Pattern.compile("/(.*/)([^/]*)=([A-Z]{3}@.*).*");
         FreenetURI key;
         for (int i = 0; i < newVals.length; i++) {
             try {
                 Matcher matcher = pattern.matcher(newVals[i]);
-                if (matcher.matches() && matcher.groupCount() == 4) {
+                if (matcher.matches()) {
                     makeParents(matcher.group(1));
-                    key = new FreenetURI(matcher.group(4));
+                    key = new FreenetURI(matcher.group(3));
                     String title = matcher.group(2);
-                    boolean hasAnActiveLink = matcher.group(3).indexOf('|') > 
-1;
+                    boolean hasAnActiveLink = false;
+                    if(title.endsWith("=|")) {
+                       hasAnActiveLink = true;
+                       title = title.substring(0, title.length()-2);
+                    } else if(title.endsWith("=")) {
+                       title = title.substring(0, title.length()-1);
+                    }
                     addBookmark(matcher.group(1), new BookmarkItem(key,
                             title, hasAnActiveLink, node.alerts));
                 }


Reply via email to