From b68a5ea7fdc92f557656049dc2c2d220fcd3516a Mon Sep 17 00:00:00 2001 From: zzz <zzz@i2pmail.org> Date: Sun, 17 Jan 2021 09:18:21 -0500 Subject: [PATCH] Router: Fix up warning about no console for split config files clean up multiple getContext() calls --- .../src/net/i2p/router/startup/ClientAppConfig.java | 2 +- .../src/net/i2p/router/startup/LoadClientAppsJob.java | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/router/java/src/net/i2p/router/startup/ClientAppConfig.java b/router/java/src/net/i2p/router/startup/ClientAppConfig.java index 538aca09d3..291c2d6659 100644 --- a/router/java/src/net/i2p/router/startup/ClientAppConfig.java +++ b/router/java/src/net/i2p/router/startup/ClientAppConfig.java @@ -95,7 +95,7 @@ public class ClientAppConfig { /** @since 0.7.12 */ public final String uninstallargs; /** @since 0.9.42 */ - private File configFile; + File configFile; public ClientAppConfig(String cl, String client, String a, long d, boolean dis) { this(cl, client, a, d, dis, null, null, null); diff --git a/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java b/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java index 3f34b33978..37749c601c 100644 --- a/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java +++ b/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java @@ -36,7 +36,8 @@ public class LoadClientAppsJob extends JobImpl { if (_loaded) return; _loaded = true; } - List<ClientAppConfig> apps = ClientAppConfig.getClientApps(getContext()); + RouterContext ctx = getContext(); + List<ClientAppConfig> apps = ClientAppConfig.getClientApps(ctx); if (apps.isEmpty()) { _log.logAlways(Log.WARN, "Warning - No client apps or router console configured - we are just a router"); System.err.println("Warning - No client apps or router console configured - we are just a router"); @@ -47,7 +48,7 @@ public class LoadClientAppsJob extends JobImpl { if (app.disabled) { if ("net.i2p.router.web.RouterConsoleRunner".equals(app.className)) { String s = "Warning - Router console is disabled. To enable,\n edit the file " + - ClientAppConfig.configFile(getContext()) + + (ClientAppConfig.isSplitConfig(ctx) ? app.configFile : ClientAppConfig.configFile(ctx)) + ",\n change the line \"clientApp." + i + ".startOnLoad=false\"" + " to \"clientApp." + i + ".startOnLoad=true\",\n and restart."; _log.logAlways(Log.WARN, s); @@ -58,14 +59,14 @@ public class LoadClientAppsJob extends JobImpl { String argVal[] = parseArgs(app.args); if (app.delay == 0) { // run this guy now - runClient(app.className, app.clientName, argVal, getContext(), _log); + runClient(app.className, app.clientName, argVal, ctx, _log); } else if (app.delay > 0) { // wait before firing it up - DelayedRunClient drc = new DelayedRunClient(getContext().simpleTimer2(), getContext(), app.className, + DelayedRunClient drc = new DelayedRunClient(ctx.simpleTimer2(), ctx, app.className, app.clientName, argVal); drc.schedule(app.delay); } else { - WaitForRunningClient wfrc = new WaitForRunningClient(getContext().simpleTimer2(), getContext(), + WaitForRunningClient wfrc = new WaitForRunningClient(ctx.simpleTimer2(), ctx, app.className, app.clientName, argVal); wfrc.schedule(1000); } -- GitLab