Author: toad
Date: 2006-12-07 19:27:53 +0000 (Thu, 07 Dec 2006)
New Revision: 11286
Modified:
trunk/freenet/src/freenet/config/StringArrOption.java
trunk/freenet/src/freenet/config/SubConfig.java
Log:
Fix isDefault() - fixes "plugins lost on restart" bug.
Don't try to load a plugin named "" if none are specified.
Logging.
Modified: trunk/freenet/src/freenet/config/StringArrOption.java
===================================================================
--- trunk/freenet/src/freenet/config/StringArrOption.java 2006-12-07
19:26:14 UTC (rev 11285)
+++ trunk/freenet/src/freenet/config/StringArrOption.java 2006-12-07
19:27:53 UTC (rev 11286)
@@ -28,7 +28,9 @@
/** Get the current value. This is the value in use if we have finished
* initialization, otherwise it is the value set at startup (possibly
the default). */
public String[] getValue() {
- return getValueString().split(delimiter);
+ String[] values = getValueString().split(delimiter);
+ if(values.length == 1 && values[0].length() == 0) return new
String[0];
+ return values;
}
public void setValue(String val) throws InvalidConfigValueException {
@@ -73,6 +75,7 @@
}
public boolean isDefault() {
+ getValueString();
return currentValue == null ? false :
currentValue.equals(defaultValue);
}
Modified: trunk/freenet/src/freenet/config/SubConfig.java
===================================================================
--- trunk/freenet/src/freenet/config/SubConfig.java 2006-12-07 19:26:14 UTC
(rev 11285)
+++ trunk/freenet/src/freenet/config/SubConfig.java 2006-12-07 19:27:53 UTC
(rev 11286)
@@ -155,6 +155,8 @@
*/
public void finishedInitialization() {
hasInitialized = true;
+ if(Logger.shouldLog(Logger.MINOR, this))
+ Logger.minor(this, "Finished initialization on "+this+"
("+prefix+')');
}
/**
@@ -188,12 +190,23 @@
SimpleFieldSet fs = new SimpleFieldSet();
Set entrySet = map.entrySet();
Iterator i = entrySet.iterator();
+ boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
+ if(logMINOR)
+ Logger.minor(this, "Prefix="+prefix);
while(i.hasNext()) {
Map.Entry entry = (Map.Entry) i.next();
String key = (String) entry.getKey();
Option o = (Option) entry.getValue();
- if(!withDefaults && o.isDefault() && !o.forceWrite)
continue;
+// if(logMINOR)
+// Logger.minor(this, "Key="+key+"
value="+o.getValueString()+" default="+o.isDefault());
+ if((!withDefaults) && o.isDefault() && (!o.forceWrite))
{
+ if(logMINOR)
+ Logger.minor(this, "Skipping "+key+" -
"+o.isDefault());
+ continue;
+ }
fs.put(key, o.getValueString());
+ if(logMINOR)
+ Logger.minor(this, "Key="+prefix+'.'+key+"
value="+o.getValueString());
}
return fs;
}