From f9eb550fbc5d4f14007c613a3e11d35cb46325a4 Mon Sep 17 00:00:00 2001 From: theli Date: Fri, 2 Sep 2005 03:34:02 +0000 Subject: [PATCH] *) Bugfix for NullpointerException in serverAbstractSwitch.setConfig See: http://www.yacy-forum.de/viewtopic.php?t=692#5575 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@636 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/server/serverAbstractSwitch.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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() {