Skip to content

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

*) Bugfix for NullpointerException in serverAbstractSwitch.setConfig See: http://www.yacy-forum.de/viewtopic.php?t=692#5575

thelif9eb550fbc5d
diff --git a/source/de/anomic/server/serverAbstractSwitch.java b/source/de/anomic/server/serverAbstractSwitch.java
index 75145d884..8baf5c442 100644
--- a/source/de/anomic/server/serverAbstractSwitch.java
+++ b/source/de/anomic/server/serverAbstractSwitch.java
@@ -151,7 +151,7 @@ public abstract class serverAbstractSwitch implements serverSwitch {
}
// set the value
- String oldValue = (String) configProps.put(key, value);
+ Object oldValue = configProps.put(key, value);
saveConfig();
// perform actions afterwards
@@ -160,7 +160,7 @@ public abstract class serverAbstractSwitch implements serverSwitch {
entry = (Map.Entry) i.next();
action = (serverSwitchAction) entry.getValue();
try {
- action.doAfterSetConfig(key, value, oldValue);
+ action.doAfterSetConfig(key, value, (oldValue==null)?null:(String)oldValue);
} catch (Exception e) {
log.logSevere("serverAction afterSetConfig '" + action.getShortDescription() + "' failed with exception: " + e.getMessage());
}
@@ -169,7 +169,7 @@ public abstract class serverAbstractSwitch implements serverSwitch {
public String getConfig(String key, String dflt) {
// get the value
- String s = (String) configProps.get(key);
+ Object s = configProps.get(key);
// do action
Map.Entry entry;
@@ -179,14 +179,14 @@ public abstract class serverAbstractSwitch implements serverSwitch {
entry = (Map.Entry) i.next();
action = (serverSwitchAction) entry.getValue();
try {
- action.doWhenGetConfig(key, s, dflt);
+ action.doWhenGetConfig(key, (s==null)?null:(String)s, dflt);
} catch (Exception e) {
log.logSevere("serverAction whenGetConfig '" + action.getShortDescription() + "' failed with exception: " + e.getMessage());
}
}
// return value
- if (s == null) return dflt; else return s;
+ if (s == null) return dflt; else return (String)s;
}
public Iterator configKeys() {