I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 2814fe75 authored by zzz's avatar zzz
Browse files

sort custom options

parent 7316c82e
No related branches found
No related tags found
No related merge requests found
...@@ -10,9 +10,11 @@ package net.i2p.i2ptunnel.web; ...@@ -10,9 +10,11 @@ package net.i2p.i2ptunnel.web;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Set; import java.util.Set;
import java.util.TreeMap;
import net.i2p.data.Base64; import net.i2p.data.Base64;
import net.i2p.data.Destination; import net.i2p.data.Destination;
...@@ -370,12 +372,11 @@ public class EditBean extends IndexBean { ...@@ -370,12 +372,11 @@ public class EditBean extends IndexBean {
if (tun != null) { if (tun != null) {
Properties opts = getOptions(tun); Properties opts = getOptions(tun);
if (opts == null) return ""; if (opts == null) return "";
StringBuilder buf = new StringBuilder(64);
int i = 0;
boolean isMD5Proxy = "httpclient".equals(tun.getType()) || boolean isMD5Proxy = "httpclient".equals(tun.getType()) ||
"connectclient".equals(tun.getType()); "connectclient".equals(tun.getType());
for (Iterator iter = opts.keySet().iterator(); iter.hasNext(); ) { Map<String, String> sorted = new TreeMap();
String key = (String)iter.next(); for (Map.Entry e : opts.entrySet()) {
String key = (String)e.getKey();
if (_noShowSet.contains(key)) if (_noShowSet.contains(key))
continue; continue;
// leave in for HTTP and Connect so it can get migrated to MD5 // leave in for HTTP and Connect so it can get migrated to MD5
...@@ -383,10 +384,18 @@ public class EditBean extends IndexBean { ...@@ -383,10 +384,18 @@ public class EditBean extends IndexBean {
if ((!isMD5Proxy) && if ((!isMD5Proxy) &&
_nonProxyNoShowSet.contains(key)) _nonProxyNoShowSet.contains(key))
continue; continue;
String val = opts.getProperty(key); sorted.put(key, (String)e.getValue());
if (i != 0) buf.append(' '); }
buf.append(key).append('=').append(val); if (sorted.isEmpty())
i++; return "";
StringBuilder buf = new StringBuilder(64);
boolean space = false;
for (Map.Entry<String, String> e : sorted.entrySet()) {
if (space)
buf.append(' ');
else
space = true;
buf.append(e.getKey()).append('=').append(e.getValue());
} }
return buf.toString(); return buf.toString();
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment