From e0f4aa281a93dc15ff10c994422b9851606e95a5 Mon Sep 17 00:00:00 2001 From: HenrikJannsen Date: Tue, 27 Dec 2022 17:11:38 -0500 Subject: [PATCH] Catch RejectedExecutionException at UncaughtExceptionHandler and log error instead calling the uncaughtExceptionHandler Signed-off-by: HenrikJannsen --- common/src/main/java/bisq/common/setup/CommonSetup.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/bisq/common/setup/CommonSetup.java b/common/src/main/java/bisq/common/setup/CommonSetup.java index 20d99a22c3..ae92f30af5 100644 --- a/common/src/main/java/bisq/common/setup/CommonSetup.java +++ b/common/src/main/java/bisq/common/setup/CommonSetup.java @@ -35,6 +35,7 @@ import java.net.URISyntaxException; import java.nio.file.Paths; +import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.TimeUnit; import ch.qos.logback.classic.Level; @@ -72,13 +73,14 @@ public class CommonSetup { public static void setupUncaughtExceptionHandler(UncaughtExceptionHandler uncaughtExceptionHandler) { Thread.UncaughtExceptionHandler handler = (thread, throwable) -> { - // Might come from another thread if (throwable.getCause() != null && throwable.getCause().getCause() != null && throwable.getCause().getCause() instanceof BlockStoreException) { - log.error(throwable.getMessage()); + log.error("Uncaught BlockStoreException ", throwable); } else if (throwable instanceof ClassCastException && "sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData".equals(throwable.getMessage())) { log.warn(throwable.getMessage()); + } else if (throwable instanceof RejectedExecutionException) { + log.error("Uncaught RejectedExecutionException ", throwable); } else if (throwable instanceof UnsupportedOperationException && "The system tray is not supported on the current platform.".equals(throwable.getMessage())) { log.warn(throwable.getMessage());