Author: toad
Date: 2007-05-09 21:10:48 +0000 (Wed, 09 May 2007)
New Revision: 13180
Modified:
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
trunk/freenet/src/freenet/node/updater/UpdateDeployContext.java
Log:
L10n keys for updater errors
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2007-05-09
20:48:43 UTC (rev 13179)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2007-05-09
21:10:48 UTC (rev 13180)
@@ -643,6 +643,12 @@
NodeUpdateManager.updateFailedTitle=Update Failed!
NodeUpdateManager.updateFailed=Update Failed: ${reason}
NodeUpdateManager.updateCatastropheTitle=Catastrophic Update Failure!
+UpdateDeployContext.updateCatastrophe=CATASTROPHIC ERROR: Deleted ${old} but
cannot rename ${new} to ${old} therefore THE NODE WILL NOT START! Please
resolve the problem by renaming ${new} to ${old} manually.
+UpdateDeployContext.updateFailedNonStandardConfig=Not able to update because
of non-standard config: written main=${main} ext=${ext} - should not happen!
Report this to the devs, include your wrapper.conf.
+UpdateDeployContext.updateFailedCannotDeleteOldConfig=Cannot delete ${old} so
cannot rename over it. Update failed.
+UpdateDeployContext.cannotUpdateNoJars=Could not find Freenet jars in
wrapper.conf
+UpdateDeployContext.cannotUpdateNoMainJar=Could not find freenet.jar in
wrapper.conf (did find freenet-ext.jar: ${extFilename})
+UpdateDeployContext.cannotUpdateNoExtJar=Could not find freenet-ext.jar in
wrapper.conf (did find freenet.jar: ${mainFilename})
PluginManager.loadedPlugins=Plugins to load on start up
PluginManager.loadedPluginsLong=A list of plugins that are started when the
node starts
PluginManager.loadedOnStartup=Plugins to load on startup
Modified: trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
2007-05-09 20:48:43 UTC (rev 13179)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
2007-05-09 21:10:48 UTC (rev 13180)
@@ -481,6 +481,9 @@
failUpdate(e.getMessage());
node.clientCore.alerts.register(new
SimpleUserAlert(false, l10n("updateCatastropheTitle"), e.getMessage(),
UserAlert.CRITICAL_ERROR));
return false;
+ } catch (UpdaterParserException e) {
+ node.clientCore.alerts.register(new
SimpleUserAlert(false, l10n("updateFailedTitle"), e.getMessage(),
UserAlert.CRITICAL_ERROR));
+ return false;
}
return true;
Modified: trunk/freenet/src/freenet/node/updater/UpdateDeployContext.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/UpdateDeployContext.java
2007-05-09 20:48:43 UTC (rev 13179)
+++ trunk/freenet/src/freenet/node/updater/UpdateDeployContext.java
2007-05-09 21:10:48 UTC (rev 13180)
@@ -13,6 +13,8 @@
import org.tanukisoftware.wrapper.WrapperManager;
+import freenet.l10n.L10n;
+
/**
* Handles the wrapper.conf, essentially.
*/
@@ -20,16 +22,13 @@
public class UpdateCatastropheException extends Exception {
- /**
- *
- */
private static final long serialVersionUID = 1L;
File oldConfig;
File newConfig;
UpdateCatastropheException(File oldConfig, File newConfig) {
- super("CATASTROPHIC ERROR: Deleted "+oldConfig+" but
cannot rename "+newConfig+" to "+oldConfig+
- " THEREFORE THE NODE WILL NOT START!
Please resolve the problem by renaming "+newConfig+" to "+oldConfig);
+ super(l10n("updateCatastrophe", new String[] { "old",
"new" },
+ new String[] { oldConfig.toString(),
newConfig.toString() }));
this.oldConfig = oldConfig;
this.newConfig = newConfig;
}
@@ -87,13 +86,25 @@
}
if(mainJar == null && extJar == null)
- throw new UpdaterParserException("Could not find
Freenet jars in wrapper.conf");
+ throw new
UpdaterParserException(l10n("cannotUpdateNoJars"));
if(mainJar == null)
- throw new UpdaterParserException("Could not find
freenet.jar in wrapper.conf (did find freenet-ext.jar: "+extJar+')');
+ throw new
UpdaterParserException(l10n("cannotUpdateNoMainJar", "extFilename",
extJar.toString()));
if(extJar == null)
- throw new UpdaterParserException("Could not find
freenet-ext.jar in wrapper.conf (did find freenet.jar: "+mainJar+')');
+ throw new
UpdaterParserException(l10n("cannotUpdateNoExtJar", "mainFilename",
mainJar.toString()));
}
+ private String l10n(String key) {
+ return L10n.getString("UpdateDeployContext."+key);
+ }
+
+ public static String l10n(String key, String[] patterns, String[]
values) {
+ return L10n.getString("UpdateDeployContext."+key, patterns,
values);
+ }
+
+ public static String l10n(String key, String pattern, String value) {
+ return L10n.getString("UpdateDeployContext."+key, pattern,
value);
+ }
+
File getMainJar() {
return mainJar;
}
@@ -110,7 +121,7 @@
return newExtJar;
}
- void rewriteWrapperConf(boolean writtenNewJar, boolean writtenNewExt)
throws IOException, UpdateCatastropheException {
+ void rewriteWrapperConf(boolean writtenNewJar, boolean writtenNewExt)
throws IOException, UpdateCatastropheException, UpdaterParserException {
// Rewrite wrapper.conf
// Don't just write it out from properties; we want to keep it
as close to what it was as possible.
@@ -157,7 +168,8 @@
br.close();
if(!((writtenMain || !writtenNewJar) && (writtenExt ||
!writtenNewExt))) {
- throw new IOException("Not able to update because of
non-standard config: written main="+writtenMain+" ext="+writtenExt+" - should
not happen! Report this to the devs, include your wrapper.conf");
+ throw new
UpdaterParserException(l10n("updateFailedNonStandardConfig",
+ new String[] { "main", "ext" }, new
String[] { Boolean.toString(writtenMain), Boolean.toString(writtenExt) } ));
}
if(!writtenReload) {
@@ -169,7 +181,7 @@
if(!newConfig.renameTo(oldConfig)) {
if(!oldConfig.delete()) {
- throw new IOException("Cannot delete
"+oldConfig+" so cannot rename over it. Update failed.");
+ throw new
UpdaterParserException(l10n("updateFailedCannotDeleteOldConfig", "old",
oldConfig.toString()));
}
if(!newConfig.renameTo(oldConfig)) {
throw new UpdateCatastropheException(oldConfig,
newConfig);