Author: toad
Date: 2006-12-19 13:29:43 +0000 (Tue, 19 Dec 2006)
New Revision: 11478

Modified:
   trunk/freenet/src/freenet/config/StringArrOption.java
Log:
Fix option encoding bug: we weren't decoding the initial value from the file, 
but we were encoding it when it was written to the file.
Now bookmarks= won't double in size on every restart.

Modified: trunk/freenet/src/freenet/config/StringArrOption.java
===================================================================
--- trunk/freenet/src/freenet/config/StringArrOption.java       2006-12-19 
13:13:20 UTC (rev 11477)
+++ trunk/freenet/src/freenet/config/StringArrOption.java       2006-12-19 
13:29:43 UTC (rev 11478)
@@ -27,12 +27,7 @@
                if(config.hasFinishedInitialization())
                        currentValue = cb.get();

-               String[] returnValue = new String[currentValue.length];
-
-               for(int i=0; i<currentValue.length; i++)
-                       returnValue[i] = decode(currentValue[i]);
-
-               return returnValue;
+               return currentValue;
        }

        public void setValue(String[] val) throws InvalidConfigValueException {
@@ -64,7 +59,11 @@
        }

        public void setInitialValue(String val) throws 
InvalidConfigValueException {
-               this.currentValue = val.split(delimiter);
+               try {
+                       this.currentValue = stringToArray(val);
+               } catch (URLEncodedFormatException e) {
+                       throw new InvalidConfigValueException("Cannot parse 
value: "+e);
+               }
        }

        public static String arrayToString(String[] arr) {
@@ -77,10 +76,6 @@
                return sb.toString();
        }

-       public static String encode(String s) {
-               return URLEncoder.encode(s);
-       }
-       
        public static String decode(String s) {
                try {
                        return URLDecoder.decode(s, false);


Reply via email to