From 4a35ef70d67114d1f6a1b041f18087127e096c33 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 25 Jun 2014 20:26:07 +0200 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20change=20the=20configuration=20a?= =?utf8?q?fter=20starting=20the=20core.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/core/Core.java | 14 +------------- src/main/java/net/pterodactylus/sone/main/SonePlugin.java | 12 +++++++----- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index ce16e6f..f1130fb 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -127,7 +127,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, private final EventBus eventBus; /** The configuration. */ - private Configuration configuration; + private final Configuration configuration; /** Whether we’re currently saving the configuration. */ private boolean storingConfiguration = false; @@ -241,18 +241,6 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } /** - * Sets the configuration to use. This will automatically save the current - * configuration to the given configuration. - * - * @param configuration - * The new configuration to use - */ - public void setConfiguration(Configuration configuration) { - this.configuration = configuration; - touchConfiguration(); - } - - /** * Returns the options used by the core. * * @return The options of the core diff --git a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java index 42eeb45..9d31b35 100644 --- a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java +++ b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java @@ -195,7 +195,13 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr } } - final Configuration startConfiguration = oldConfiguration; + final Configuration startConfiguration; + if ((newConfiguration != null) && (oldConfiguration != newConfiguration)) { + logger.log(Level.INFO, "Setting configuration to file-based configuration."); + startConfiguration = newConfiguration; + } else { + startConfiguration = oldConfiguration; + } final EventBus eventBus = new EventBus(); /* Freenet injector configuration. */ @@ -264,10 +270,6 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr /* start core! */ core.start(); - if ((newConfiguration != null) && (oldConfiguration != newConfiguration)) { - logger.log(Level.INFO, "Setting configuration to file-based configuration."); - core.setConfiguration(newConfiguration); - } webInterface.start(); webInterface.setFirstStart(firstStart); webInterface.setNewConfig(newConfig); -- 2.7.4