Plugins: less confusing message, fix CNFE by catch and ignore on delete.

This commit is contained in:
sponge
2012-03-19 01:46:47 +00:00
parent 8ca5591933
commit d1ed30e79c
4 changed files with 15 additions and 4 deletions

View File

@ -1,7 +1,6 @@
package net.i2p.router.web; package net.i2p.router.web;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -88,6 +87,15 @@ public class ConfigClientsHandler extends FormHandler {
} else { } else {
try { try {
PluginStarter.stopPlugin(_context, app); PluginStarter.stopPlugin(_context, app);
} catch (ClassNotFoundException cnfe) {
// don't complain here. Some plugins need to be ran to be deleted.
// I tried to check to see if the plugin was ran elsewhere,
// and it sait it was when it was not. -- Sponge
} catch (Throwable e) {
addFormError(_("Error stopping plugin {0}", app) + ": " + e);
_log.error("Error stopping plugin " + app, e);
}
try {
PluginStarter.deletePlugin(_context, app); PluginStarter.deletePlugin(_context, app);
addFormNotice(_("Deleted plugin {0}", app)); addFormNotice(_("Deleted plugin {0}", app));
} catch (Throwable e) { } catch (Throwable e) {

View File

@ -122,7 +122,7 @@ public class PluginUpdateHandler extends UpdateHandler {
protected void update() { protected void update() {
_updated = false; _updated = false;
if(_xpi2pURL.startsWith("file://")) { if(_xpi2pURL.startsWith("file://")) {
updateStatus("<b>" + _("Attempting to copy plugin from {0}", _xpi2pURL) + "</b>"); updateStatus("<b>" + _("Attempting to install from file {0}", _xpi2pURL) + "</b>");
// strip off "file://" // strip off "file://"
String xpi2pfile = _xpi2pURL.substring(7); String xpi2pfile = _xpi2pURL.substring(7);
if(xpi2pfile.length() == 0) { // This is actually what String.isEmpty() does, so it should be safe. if(xpi2pfile.length() == 0) { // This is actually what String.isEmpty() does, so it should be safe.
@ -133,7 +133,7 @@ public class PluginUpdateHandler extends UpdateHandler {
if(FileUtil.copy((new File(xpi2pfile)).getAbsolutePath(), _updateFile, true, false)) { if(FileUtil.copy((new File(xpi2pfile)).getAbsolutePath(), _updateFile, true, false)) {
transferComplete(alreadyTransferred, alreadyTransferred, 0L, _xpi2pURL, _updateFile, false); transferComplete(alreadyTransferred, alreadyTransferred, 0L, _xpi2pURL, _updateFile, false);
} else { } else {
statusDone("<b>" + _("Failed to copy file {0}", _xpi2pURL) + "</b>"); statusDone("<b>" + _("Failed to install from file {0}, copy failed.", _xpi2pURL) + "</b>");
} }
} }
} else { } else {

View File

@ -1,3 +1,6 @@
2012-03-19 sponge
* Plugins: less confusing message, fix CNFE by catch and ignore on delete.
2012-03-17 zzz 2012-03-17 zzz
* BuildHandler: Implement restart and shutdown to stop the thread * BuildHandler: Implement restart and shutdown to stop the thread
* Jetty: Don't extract wars * Jetty: Don't extract wars

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 17; public final static long BUILD = 18;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";