Author: nextgens
Date: 2007-03-26 09:50:57 +0000 (Mon, 26 Mar 2007)
New Revision: 12382

Modified:
   trunk/freenet/src/freenet/keys/FreenetURI.java
Log:
Hopefully fix that

----- Anonymous ----- 2007.03.25 - 18:36:50GMT -----

When accessing a Freenet key that accidentally contains a space at the end, you 
will get an java.net.MalformedURLException with 
java.lang.NumberFormatException: For input string: "1 "

This happens e.g. when the key in the clipboard contains a CR-LF at the end and 
the browser converts this to spaces.

Maybe this could be fixed by removing trailing spaces before processing the key.

Modified: trunk/freenet/src/freenet/keys/FreenetURI.java
===================================================================
--- trunk/freenet/src/freenet/keys/FreenetURI.java      2007-03-26 09:47:14 UTC 
(rev 12381)
+++ trunk/freenet/src/freenet/keys/FreenetURI.java      2007-03-26 09:50:57 UTC 
(rev 12382)
@@ -217,7 +217,8 @@
        public FreenetURI(String URI) throws MalformedURLException {
                if (URI == null) {
                        throw new MalformedURLException("No URI specified");
-               }
+               } else
+                       URI = URI.trim();

                if(URI.indexOf('@') < 0 || URI.indexOf('/') < 0) {
                        // Encoded URL?


Reply via email to