diff options
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/App.java | 12 | ||||
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/Gui.java | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java index 6fb45d35..f8fed2d1 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java @@ -133,6 +133,18 @@ public class App { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { + Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + @Override + public void uncaughtException(Thread t, Throwable e) { + Gui.showMessageBox( + null, + "Ungefangene Ausnahme in Faden " + + t.getName() + + "\n" + + "Die Anwendung könnte instabil laufen. Zur Sicherheit sollten Sie sie neustarten.", + MessageType.WARNING, null, e); + } + }); MainWindow.open(); } }); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/Gui.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/Gui.java index 879d73db..0b961461 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/Gui.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/Gui.java @@ -251,14 +251,14 @@ public class Gui { */ public static boolean showMessageBox(Component parent, String message, MessageType messageType, Logger logger, Throwable exception) { + if (logger != null) + logger.log(messageType.logPriority, message, exception); if (parent != null) { Window ancestor = SwingUtilities.getWindowAncestor(parent); if (ancestor != null) { parent = ancestor; } } - if (logger != null) - logger.log(messageType.logPriority, message, exception); if (exception != null) message += "\n\n" + exception.getClass().getSimpleName() + "\n" + exception.getMessage() + "\n" + " (Siehe Logdatei)"; |