Author: dbkr
Date: 2006-03-24 22:02:27 +0000 (Fri, 24 Mar 2006)
New Revision: 8306
Modified:
trunk/freenet/src/freenet/clients/http/BookmarkManager.java
trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
trunk/freenet/src/freenet/node/Version.java
Log:
569: "Whoops". Only subscribe to USKs, and add an error message since it now
needs to parse (or possibly fail to parse) given bookmarks as freenet keys.
Modified: trunk/freenet/src/freenet/clients/http/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BookmarkManager.java 2006-03-24
21:37:40 UTC (rev 8305)
+++ trunk/freenet/src/freenet/clients/http/BookmarkManager.java 2006-03-24
22:02:27 UTC (rev 8306)
@@ -101,11 +101,13 @@
public void addBookmark(Bookmark b) {
this.bookmarks.add(b);
- try {
- USK u = new USK(b.key);
- this.node.uskManager.subscribe(u, this.uskcb, true);
- } catch (MalformedURLException mue) {
+ if (b.getKeyType().equals("USK")) {
+ try {
+ USK u = new USK(b.key);
+ this.node.uskManager.subscribe(u, this.uskcb,
true);
+ } catch (MalformedURLException mue) {
+ }
}
}
@@ -114,11 +116,13 @@
Bookmark i = (Bookmark) e.nextElement();
if (i.hashCode() == hashcode) {
- try {
- USK u = new USK(i.key);
- this.node.uskManager.subscribe(u,
this.uskcb, true);
- } catch (MalformedURLException mue) {
-
+ if (i.getKeyType().equals("USK")) {
+ try {
+ USK u = new USK(i.key);
+
this.node.uskManager.subscribe(u, this.uskcb, true);
+ } catch (MalformedURLException mue) {
+
+ }
}
this.bookmarks.remove(i);
}
Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2006-03-24
21:37:40 UTC (rev 8305)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2006-03-24
22:02:27 UTC (rev 8306)
@@ -92,7 +92,12 @@
ctx.getPageMaker().makeTail(buf);
writeReply(ctx, 200, "text/html", "OK", buf.toString());
} else if (request.getParam("newbookmark").length() > 0) {
- bookmarks.addBookmark(new
Bookmark(request.getParam("newbookmark"), request.getParam("name")));
+ try {
+ bookmarks.addBookmark(new
Bookmark(request.getParam("newbookmark"), request.getParam("name")));
+ } catch (MalformedURLException mue) {
+ this.sendErrorPage(ctx, 200, "Invalid freenet
key", "Could not add the given item as a bookmark since it was not possible to
interpret it as a freenet key. Please <a href=\"/\">Try Again</a>");
+ return;
+ }
this.handleGet(uri, ctx);
} else {
Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-03-24 21:37:40 UTC (rev
8305)
+++ trunk/freenet/src/freenet/node/Version.java 2006-03-24 22:02:27 UTC (rev
8306)
@@ -20,7 +20,7 @@
public static final String protocolVersion = "1.0";
/** The build number of the current revision */
- private static final int buildNumber = 568;
+ private static final int buildNumber = 569;
/** Oldest build of Fred we will talk to */
private static final int lastGoodBuild = 507;