Fix uncaught exception handler

The default handler was mistakenly retrieved after our custom handler
was set, causing it to reference itself. As a result, this led to
infinite recursion.

Bug introduced by eee3f24739.
This commit is contained in:
Romain Vimont
2025-11-04 20:35:39 +01:00
parent d0047b2110
commit 3530851071

View File

@@ -225,8 +225,8 @@ public final class Server {
} }
private static void internalMain(String... args) throws Exception { private static void internalMain(String... args) throws Exception {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler((t, e) -> { Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
Ln.e("Exception on thread " + t, e); Ln.e("Exception on thread " + t, e);
if (defaultHandler != null) { if (defaultHandler != null) {
defaultHandler.uncaughtException(t, e); defaultHandler.uncaughtException(t, e);