[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10206: Make java controller code handle config optiions that are se (torctl/trunk/java/net/freehaven/tor/control)



Author: nickm
Date: 2007-05-18 16:53:49 -0400 (Fri, 18 May 2007)
New Revision: 10206

Modified:
   torctl/trunk/java/net/freehaven/tor/control/ConfigEntry.java
   torctl/trunk/java/net/freehaven/tor/control/TorControlConnection1.java
Log:
Make java controller code handle config optiions that are set to their defaults.  Fixes bug 408.

Modified: torctl/trunk/java/net/freehaven/tor/control/ConfigEntry.java
===================================================================
--- torctl/trunk/java/net/freehaven/tor/control/ConfigEntry.java	2007-05-18 13:53:13 UTC (rev 10205)
+++ torctl/trunk/java/net/freehaven/tor/control/ConfigEntry.java	2007-05-18 20:53:49 UTC (rev 10206)
@@ -8,7 +8,14 @@
     public ConfigEntry(String k, String v) {
         key = k;
         value = v;
+        is_default = false;
     }
+    public ConfigEntry(String k) {
+        key = k;
+        value = "";
+        is_default = true;
+    }
     public final String key;
     public final String value;
+    public final boolean is_default;
 }

Modified: torctl/trunk/java/net/freehaven/tor/control/TorControlConnection1.java
===================================================================
--- torctl/trunk/java/net/freehaven/tor/control/TorControlConnection1.java	2007-05-18 13:53:13 UTC (rev 10205)
+++ torctl/trunk/java/net/freehaven/tor/control/TorControlConnection1.java	2007-05-18 20:53:49 UTC (rev 10206)
@@ -322,8 +322,11 @@
         for (Iterator it = lst.iterator(); it.hasNext(); ) {
             String kv = ((ReplyLine) it.next()).msg;
             int idx = kv.indexOf('=');
-            result.add(new ConfigEntry(kv.substring(0, idx),
-                                       kv.substring(idx+1)));
+            if (idx >= 0)
+                result.add(new ConfigEntry(kv.substring(0, idx),
+                                           kv.substring(idx+1)));
+            else
+                result.add(new ConfigEntry(kv));
         }
         return result;
     }