Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) preventing whitespace keys in config file

low012e25c1f2ea3a6
diff --git a/htroot/ConfigProperties_p.java b/htroot/ConfigProperties_p.java
index e5b79483f..3b60a51b2 100644
--- a/htroot/ConfigProperties_p.java
+++ b/htroot/ConfigProperties_p.java
@@ -1,4 +1,4 @@
-// ConfigGeneric_p.java
+// ConfigProperties_p.java
// -----------------------
// part of YaCy
// (C) by Michael Peter Christen; [email protected]
@@ -43,29 +43,30 @@ public class ConfigProperties_p {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- int count = 0;
+
String key;
//change a key
- if(post != null && post.containsKey("key") && post.containsKey("value")){
- key = post.get("key");
- final String value = post.get("value");
- if (!"".equals(key)) {
- env.setConfig(key, value);
+ if (post != null && post.containsKey("key") && post.containsKey("value")) {
+ key = post.get("key").trim();
+ if (key != null && !key.isEmpty()) {
+ env.setConfig(key, post.get("value").trim());
}
}
+
Iterator<String> keys = env.configKeys();
final List<String> list = new ArrayList<String>(250);
- while(keys.hasNext()){
+ while (keys.hasNext()) {
list.add(keys.next());
}
-
+
Collections.sort(list);
-
+
+ int count = 0;
keys = list.iterator();
- while(keys.hasNext()){
+ while (keys.hasNext()) {
key = keys.next();
// only display lines if they are no commment