diff --git a/common/src/main/java/bisq/common/config/ConfigFileOption.java b/common/src/main/java/bisq/common/config/ConfigFileOption.java index 58c440d8f5..a35ddc33a1 100644 --- a/common/src/main/java/bisq/common/config/ConfigFileOption.java +++ b/common/src/main/java/bisq/common/config/ConfigFileOption.java @@ -20,7 +20,7 @@ class ConfigFileOption { String[] tokens = clean(option).split("="); String name = tokens[0].trim(); - String arg = tokens[1].trim(); + String arg = tokens.length > 1 ? tokens[1].trim() : ""; return new ConfigFileOption(name, arg); } diff --git a/common/src/test/java/bisq/common/config/ConfigFileOptionTests.java b/common/src/test/java/bisq/common/config/ConfigFileOptionTests.java index 55e88d4dce..a8de344b27 100644 --- a/common/src/test/java/bisq/common/config/ConfigFileOptionTests.java +++ b/common/src/test/java/bisq/common/config/ConfigFileOptionTests.java @@ -33,4 +33,13 @@ public class ConfigFileOptionTests { assertThat(option.arg, equalTo("example.com:8080")); assertThat(option.toString(), equalTo("host1=example.com:8080")); } + + @Test + public void whenOptionHasNoValue_thenItSetsEmptyValue() { + String value = "host1="; + ConfigFileOption option = ConfigFileOption.parse(value); + assertThat(option.name, equalTo("host1")); + assertThat(option.arg, equalTo("")); + assertThat(option.toString(), equalTo("host1=")); + } }