Author: toad
Date: 2007-02-13 20:36:21 +0000 (Tue, 13 Feb 2007)
New Revision: 11770
Modified:
trunk/freenet/src/freenet/config/SubConfig.java
trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
Log:
Upgrade node.updater settings.
SubConfig.fixOldDefaultRegex.
Modified: trunk/freenet/src/freenet/config/SubConfig.java
===================================================================
--- trunk/freenet/src/freenet/config/SubConfig.java 2007-02-13 18:05:10 UTC
(rev 11769)
+++ trunk/freenet/src/freenet/config/SubConfig.java 2007-02-13 20:36:21 UTC
(rev 11770)
@@ -231,12 +231,32 @@
o.setValue(value);
}
+ /**
+ * If the option's value is equal to the provided old default, then set
it to the
+ * new default. Used to deal with changes to important options where
this is not
+ * handled automatically because the option's value is written to the
.ini.
+ * @param name The name of the option.
+ * @param value The value of the option.
+ */
public void fixOldDefault(String name, String value) {
Option o = (Option) map.get(name);
if(o.getValueString().equals(value))
o.setDefault();
}
+ /**
+ * If the option's value matches the provided old default regex, then
set it to the
+ * new default. Used to deal with changes to important options where
this is not
+ * handled automatically because the option's value is written to the
.ini.
+ * @param name The name of the option.
+ * @param value The value of the option.
+ */
+ public void fixOldDefaultRegex(String name, String value) {
+ Option o = (Option) map.get(name);
+ if(o.getValueString().matches(value))
+ o.setDefault();
+ }
+
public String getPrefix(){
return prefix;
}
@@ -251,4 +271,5 @@
return -1;
}
}
+
}
Modified: trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
2007-02-13 18:05:10 UTC (rev 11769)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
2007-02-13 20:36:21 UTC (rev 11770)
@@ -98,6 +98,8 @@
true, false, "Where should the node look for updates?",
"Where should the node look for updates?",
new UpdateURICallback(false));
+
+ updaterConfig.fixOldDefaultRegex("URI", "USK at
SIDKS6l-eOU8IQqDo03d~3qqBd-69WG60aDgg4nWqss,CPFqYi95Is3GwzAdAKtAuFMCXDZFFWC3~uPoidCD67s,AQABAAE/update/[0-9]++");
try {
updateURI = new
FreenetURI(updaterConfig.getString("URI"));
@@ -116,6 +118,8 @@
"Where should the node look for revocation ?",
new UpdateRevocationURICallback());
+ updaterConfig.fixOldDefault("revocationURI", "SSK at
VOfCZVTYPaatJ~eB~4lu2cPrWEmGyt4bfbB1v15Z6qQ,B6EynLhm7QE0se~rMgWWhl7wh3rFWjxJsEUcyohAm8A,AQABAAE/revoked");
+
try {
revocationURI = new
FreenetURI(updaterConfig.getString("revocationURI"));
} catch (MalformedURLException e) {
@@ -133,6 +137,8 @@
"Where should the node look for updates to
freenet-ext.jar?",
new UpdateURICallback(true));
+ updaterConfig.fixOldDefaultRegex("extURI", "USK at
SIDKS6l-eOU8IQqDo03d~3qqBd-69WG60aDgg4nWqss,CPFqYi95Is3GwzAdAKtAuFMCXDZFFWC3~uPoidCD67s,AQABAAE/ext/[0-9]++");
+
try {
extURI = new
FreenetURI(updaterConfig.getString("extURI"));
} catch (MalformedURLException e) {