Author: toad
Date: 2007-11-19 23:00:52 +0000 (Mon, 19 Nov 2007)
New Revision: 15865

Modified:
   trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
Log:
try again at the classcastexception

Modified: trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java   
2007-11-19 22:57:09 UTC (rev 15864)
+++ trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java   
2007-11-19 23:00:52 UTC (rev 15865)
@@ -212,9 +212,9 @@
                                        form.addChild("input", new 
String[]{"type", "id", "name", "size", "value"}, new String []{"text", "name", 
"name", "20", "edit".equals(action)?bookmark.getName():""});

                                        form.addChild("br");
-                                       if (("edit".equals(action) && bookmark 
instanceof BookmarkItem) || "addItem".equals(action)) {
-                                               BookmarkItem item = null;
-                                               if(bookmark != null) item = 
(BookmarkItem) bookmark;
+                                       boolean isNew = false;
+                                       if (("edit".equals(action) && bookmark 
instanceof BookmarkItem) || (isNew = "addItem".equals(action))) {
+                                               BookmarkItem item = isNew ? 
null : (BookmarkItem) bookmark;
                                                String key = 
(action.equals("edit") ? item.getKey() : "");
                                                form.addChild("label", "for", 
"key", (L10n.getString("BookmarkEditorToadlet.keyLabel") + ' '));
                                                form.addChild("input", new 
String[]{"type", "id", "name", "size", "value"}, new String []{"text", "key", 
"key", "50", key});


Reply via email to