diff --git a/common/src/main/java/bisq/common/config/Config.java b/common/src/main/java/bisq/common/config/Config.java index d05be693f9..c1153f0467 100644 --- a/common/src/main/java/bisq/common/config/Config.java +++ b/common/src/main/java/bisq/common/config/Config.java @@ -28,6 +28,8 @@ import java.util.Optional; import ch.qos.logback.classic.Level; +import lombok.Getter; + import static com.google.common.base.Preconditions.checkNotNull; import static java.lang.String.format; import static java.util.stream.Collectors.toList; @@ -157,7 +159,8 @@ public class Config { // Options supported only at the command-line interface (cli) public final boolean helpRequested; - public final File configFile; + @Getter + private final File configFile; // Options supported on cmd line and in the config file public final String appName; diff --git a/common/src/test/java/bisq/common/config/ConfigTests.java b/common/src/test/java/bisq/common/config/ConfigTests.java index bd6b7f9c59..ab578d7018 100644 --- a/common/src/test/java/bisq/common/config/ConfigTests.java +++ b/common/src/test/java/bisq/common/config/ConfigTests.java @@ -53,7 +53,7 @@ public class ConfigTests { assertThat(config.appName, equalTo(config.defaultAppName)); assertThat(config.userDataDir, equalTo(config.defaultUserDataDir)); assertThat(config.appDataDir, equalTo(config.defaultAppDataDir)); - assertThat(config.configFile, equalTo(config.defaultConfigFile)); + assertThat(config.getConfigFile(), equalTo(config.defaultConfigFile)); } @Test @@ -62,7 +62,7 @@ public class ConfigTests { assertThat(config.appName, equalTo("My-Bisq")); assertThat(config.userDataDir, equalTo(config.defaultUserDataDir)); assertThat(config.appDataDir, equalTo(new File(config.userDataDir, "My-Bisq"))); - assertThat(config.configFile, equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME))); + assertThat(config.getConfigFile(), equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME))); } @Test @@ -72,7 +72,7 @@ public class ConfigTests { assertThat(config.appName, equalTo(config.defaultAppName)); assertThat(config.userDataDir, equalTo(config.defaultUserDataDir)); assertThat(config.appDataDir, equalTo(appDataDir)); - assertThat(config.configFile, equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME))); + assertThat(config.getConfigFile(), equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME))); } @Test @@ -82,7 +82,7 @@ public class ConfigTests { assertThat(config.appName, equalTo(config.defaultAppName)); assertThat(config.userDataDir, equalTo(userDataDir)); assertThat(config.appDataDir, equalTo(new File(userDataDir, config.defaultAppName))); - assertThat(config.configFile, equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME))); + assertThat(config.getConfigFile(), equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME))); } @Test @@ -92,7 +92,7 @@ public class ConfigTests { assertThat(config.appName, equalTo("My-Bisq")); assertThat(config.userDataDir, equalTo(config.defaultUserDataDir)); assertThat(config.appDataDir, equalTo(appDataDir)); - assertThat(config.configFile, equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME))); + assertThat(config.getConfigFile(), equalTo(new File(config.appDataDir, DEFAULT_CONFIG_FILE_NAME))); } @Test @@ -166,7 +166,7 @@ public class ConfigTests { public void whenConfigFileOptionIsSetToExistingFile_thenConfigFilePropertyReflectsItsValue() throws IOException { File configFile = File.createTempFile("bisq", "properties"); Config config = configWithOpts(opt(CONFIG_FILE, configFile.getAbsolutePath())); - assertThat(config.configFile, equalTo(configFile)); + assertThat(config.getConfigFile(), equalTo(configFile)); } @Test @@ -175,7 +175,7 @@ public class ConfigTests { File appDataDir = configFile.getParentFile(); String relativeConfigFilePath = configFile.getName(); Config config = configWithOpts(opt(APP_DATA_DIR, appDataDir), opt(CONFIG_FILE, relativeConfigFilePath)); - assertThat(config.configFile, equalTo(configFile)); + assertThat(config.getConfigFile(), equalTo(configFile)); } @Test @@ -188,7 +188,7 @@ public class ConfigTests { assertThat(config.appName, equalTo("My-Bisq")); assertThat(config.userDataDir, equalTo(config.defaultUserDataDir)); assertThat(config.appDataDir, equalTo(new File(config.userDataDir, config.appName))); - assertThat(config.configFile, equalTo(configFile)); + assertThat(config.getConfigFile(), equalTo(configFile)); } @Test diff --git a/core/src/main/java/bisq/core/filter/FilterManager.java b/core/src/main/java/bisq/core/filter/FilterManager.java index 0fc5c7a950..68ddab6740 100644 --- a/core/src/main/java/bisq/core/filter/FilterManager.java +++ b/core/src/main/java/bisq/core/filter/FilterManager.java @@ -128,7 +128,7 @@ public class FilterManager { this.keyRing = keyRing; this.user = user; this.preferences = preferences; - this.configFileEditor = new ConfigFileEditor(config.configFile); + this.configFileEditor = new ConfigFileEditor(config.getConfigFile()); this.providersRepository = providersRepository; this.ignoreDevMsg = ignoreDevMsg; diff --git a/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java b/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java index 80c1a710d0..19071fb841 100644 --- a/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java +++ b/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java @@ -158,7 +158,7 @@ public class NetworkSettingsView extends ActivatableView { this.localBitcoinNode = localBitcoinNode; this.torNetworkSettingsWindow = torNetworkSettingsWindow; this.clockWatcher = clockWatcher; - this.configFileEditor = new ConfigFileEditor(config.configFile); + this.configFileEditor = new ConfigFileEditor(config.getConfigFile()); } public void initialize() {