Plugins: Fix bug in stopping a ClientApp plugin with $parameters in the args

This commit is contained in:
zzz
2014-11-12 14:38:13 +00:00
parent fd7e549915
commit f19ec4bd44
3 changed files with 18 additions and 3 deletions

View File

@ -672,8 +672,20 @@ public class PluginStarter implements Runnable {
// If the client is a running ClientApp that we want to stop,
// bypass all the logic below.
if (action.equals("stop")) {
ClientApp ca = ctx.routerAppManager().getClientApp(app.className, LoadClientAppsJob.parseArgs(app.args));
if (ca != null && ca.getState() == ClientAppState.RUNNING) {
String[] argVal = LoadClientAppsJob.parseArgs(app.args);
// We must do all the substitution just as when started, so the
// argument array comparison in getClientApp() works.
// Do this after parsing so we don't need to worry about quoting
for (int i = 0; i < argVal.length; i++) {
if (argVal[i].indexOf("$") >= 0) {
argVal[i] = argVal[i].replace("$I2P", ctx.getBaseDir().getAbsolutePath());
argVal[i] = argVal[i].replace("$CONFIG", ctx.getConfigDir().getAbsolutePath());
argVal[i] = argVal[i].replace("$PLUGIN", pluginDir.getAbsolutePath());
}
}
ClientApp ca = ctx.routerAppManager().getClientApp(app.className, argVal);
if (ca != null) {
// even if (ca.getState() != ClientAppState.RUNNING), we do this, we don't want to fall thru
try {
ca.shutdown(LoadClientAppsJob.parseArgs(app.stopargs));
} catch (Throwable t) {

View File

@ -1,3 +1,6 @@
2014-11-12 zzz
* Plugins: Fix bug in stopping a ClientApp plugin with $parameters in the args
2014-11-09 zzz
* i2psnark: Fix tracker config form issues
* Router, i2ptunnel: Add option for per-pool persistent random key,

View File

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