diff --git a/common/src/main/java/bisq/common/config/Config.java b/common/src/main/java/bisq/common/config/Config.java index a9fc517a215..dac6afe545c 100644 --- a/common/src/main/java/bisq/common/config/Config.java +++ b/common/src/main/java/bisq/common/config/Config.java @@ -802,7 +802,7 @@ private static File mkAppDataDir(File appDataDir) { try { Files.createDirectories(path); } catch (IOException ex) { - throw new ConfigException(ex, "Application data directory '%s' could not be created", path); + throw new UncheckedIOException(format("Application data directory '%s' could not be created", path), ex); } return appDataDir; } @@ -819,7 +819,7 @@ private static File mkdir(File parent, String child) { try { Files.createDirectory(path); } catch (IOException ex) { - throw new ConfigException(ex, "Directory '%s' could not be created", path); + throw new UncheckedIOException(format("Directory '%s' could not be created", path), ex); } } return dir; diff --git a/common/src/main/java/bisq/common/config/ConfigException.java b/common/src/main/java/bisq/common/config/ConfigException.java index 4a4e955456d..0d709dcf53e 100644 --- a/common/src/main/java/bisq/common/config/ConfigException.java +++ b/common/src/main/java/bisq/common/config/ConfigException.java @@ -7,8 +7,4 @@ public class ConfigException extends BisqException { public ConfigException(String format, Object... args) { super(format, args); } - - public ConfigException(Throwable cause, String format, Object... args) { - super(cause, format, args); - } } diff --git a/common/src/test/java/bisq/common/config/ConfigTests.java b/common/src/test/java/bisq/common/config/ConfigTests.java index de9593917be..6109342b339 100644 --- a/common/src/test/java/bisq/common/config/ConfigTests.java +++ b/common/src/test/java/bisq/common/config/ConfigTests.java @@ -7,6 +7,7 @@ import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; +import java.io.UncheckedIOException; import org.junit.Rule; import org.junit.Test; @@ -228,10 +229,10 @@ public void whenConfigIsConstructed_thenAppDataDirAndSubdirsAreCreated() { } @Test - public void whenAppDataDirCannotBeCreated_thenConfigExceptionIsThrown() throws IOException { + public void whenAppDataDirCannotBeCreated_thenUncheckedIoExceptionIsThrown() throws IOException { // set a userDataDir that is actually a file so appDataDir cannot be created File aFile = Files.createTempFile("A", "File").toFile(); - exceptionRule.expect(ConfigException.class); + exceptionRule.expect(UncheckedIOException.class); exceptionRule.expectMessage(containsString("Application data directory")); exceptionRule.expectMessage(containsString("could not be created")); configWithOpts(opt(USER_DATA_DIR, aFile));