Author: nextgens
Date: 2007-11-21 00:36:09 +0000 (Wed, 21 Nov 2007)
New Revision: 15897

Modified:
   trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
Log:
BookmarkToadlet: save the bookmark file only if there is no parse error reading 
it

Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2007-11-21 00:31:21 UTC (rev 15896)
+++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2007-11-21 00:36:09 UTC (rev 15897)
@@ -376,6 +376,7 @@
     }

     private void _innerReadBookmarks(String prefix, BookmarkCategory category, 
SimpleFieldSet sfs) {
+        boolean hasBeenParsedWithoutAnyProblem = true;
         boolean isRoot = ("".equals(prefix) && MAIN_CATEGORY.equals(category));
         synchronized (bookmarks) {
             if(!isRoot)
@@ -401,9 +402,11 @@
                     category.addBookmark(item);
                 } catch (MalformedURLException e) {
                     Logger.error(this, "Error while adding one of the 
bookmarks :" + e.getMessage(), e);
+                    hasBeenParsedWithoutAnyProblem = false;
                 }
             }
         }
-        storeBookmarks();
+        if(hasBeenParsedWithoutAnyProblem)
+            storeBookmarks();
     }
 }


Reply via email to