Author: nextgens
Date: 2007-11-20 22:06:13 +0000 (Tue, 20 Nov 2007)
New Revision: 15892
Modified:
trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
Log:
BookmarkToadlet: simplify the logic
Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
2007-11-20 22:03:10 UTC (rev 15891)
+++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
2007-11-20 22:06:13 UTC (rev 15892)
@@ -353,8 +353,9 @@
}
private void _innerReadBookmarks(String prefix, BookmarkCategory category,
SimpleFieldSet sfs) {
+ boolean isRoot = ("".equals(prefix) && MAIN_CATEGORY.equals(category));
synchronized (bookmarks) {
- if(!"".equals(prefix))
+ if(!isRoot)
putPaths(prefix + category.name + '/', category);
String[] categories = sfs.namesOfDirectSubsets();
@@ -363,7 +364,7 @@
BookmarkCategory currentCategory = new
BookmarkCategory(categories[i]);
String name = prefix + category.name + '/';
category.addBookmark(currentCategory);
- _innerReadBookmarks((MAIN_CATEGORY.equals(category) ? "/" :
name), currentCategory, subset);
+ _innerReadBookmarks((isRoot ? "/" : name), currentCategory,
subset);
}
Iterator it = sfs.toplevelKeyIterator();
@@ -372,7 +373,7 @@
String line = sfs.get(key);
try {
BookmarkItem item = new BookmarkItem(line, node.alerts);
- String name = ("".equals(prefix) ? "" : prefix +
category.name) + '/' +item.name;
+ String name = (isRoot ? "" : prefix + category.name) + '/'
+item.name;
putPaths(name, item);
category.addBookmark(item);
} catch (MalformedURLException e) {