summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src
diff options
context:
space:
mode:
authorSimon Rettberg2022-03-21 17:44:07 +0100
committerSimon Rettberg2022-03-21 17:44:07 +0100
commitd58ebb8b71c207e0bcedcf14b67ed92efc9b5bd5 (patch)
tree2f1293c81de323f58b327dc0db46206c81f8ddd7 /dozentenmodul/src
parent[client] Memory management; handle OOM when hashing, do not skip blocks (diff)
downloadtutor-module-d58ebb8b71c207e0bcedcf14b67ed92efc9b5bd5.tar.gz
tutor-module-d58ebb8b71c207e0bcedcf14b67ed92efc9b5bd5.tar.xz
tutor-module-d58ebb8b71c207e0bcedcf14b67ed92efc9b5bd5.zip
[client] Install default thread exception handler
Diffstat (limited to 'dozentenmodul/src')
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/App.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
index e7242a6f..36ea083b 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
@@ -134,6 +134,14 @@ public class App {
MessageType.ERROR, LOGGER, e);
return;
}
+
+ // Do this early on, before we start fiddling with threads
+ Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ LOGGER.warn("Uncaught Exception in thread " + t.getName(), e);
+ }
+ });
final String logFilePath = setupFileLogger();
AppUtil.logHeader(LOGGER, Branding.getApplicationName(), App.class.getPackage().getImplementationVersion());
@@ -247,7 +255,15 @@ public class App {
ThriftManager.setMasterServerAddress(null, host, port, THRIFT_TIMEOUT_MS);
}
- // Setup global thrift connection error handler and then open the GUI
+ // Now change the default exception handler to the GUI one
+ Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ Gui.asyncMessageBox(I18n.APP.getString("App.Message.warning.uncaughtException", t.getName()),
+ MessageType.WARNING, LOGGER, e);
+ }
+ });
+ // Setup GUI thread exception handler and then open the GUI
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {