Author: nextgens
Date: 2007-11-30 21:29:24 +0000 (Fri, 30 Nov 2007)
New Revision: 16154
Modified:
trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
Log:
BookmarkManager: fix rename()
Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
2007-11-30 21:12:35 UTC (rev 16153)
+++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
2007-11-30 21:29:24 UTC (rev 16154)
@@ -223,21 +223,13 @@
public void renameBookmark(String path, String newName) {
Bookmark bookmark = getBookmarkByPath(path);
-
String oldName = bookmark.getName();
- String oldPath = '/' + oldName + '/';
- String newPath = oldPath.substring(0, oldPath.indexOf(oldName))
+ newName;
-
+ String oldPath = '/' + oldName;
+ String newPath = path.substring(0, path.indexOf(oldPath)) + '/'
+ newName + (bookmark instanceof BookmarkCategory ? "/" : "");
+
bookmark.setName(newName);
synchronized(bookmarks) {
bookmarks.remove(path);
- }
- if(path.charAt(path.length() - 1) != '/') {
- int lastIndexOfSlash = path.lastIndexOf('/');
- newPath = path.substring(0, lastIndexOfSlash) + newPath;
- } else
- newPath += '/';
- synchronized(bookmarks) {
bookmarks.put(newPath, bookmark);
}
storeBookmarks();