From 79a0dacdbc9fc4c2fdf86c379e41402ce7ba6b0b Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 9 Nov 2015 05:55:12 +0000 Subject: [PATCH] * simplify error handling --- source/net/filebot/Main.java | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/source/net/filebot/Main.java b/source/net/filebot/Main.java index 63260937..0a318001 100644 --- a/source/net/filebot/Main.java +++ b/source/net/filebot/Main.java @@ -173,22 +173,15 @@ public class Main { } // GUI mode => start user interface - try { - SwingUtilities.invokeAndWait(() -> { - try { - // use native laf an all platforms - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (Exception e) { - Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e); - } - startUserInterface(args); - }); - } catch (InvocationTargetException e) { - Logger.getLogger(Main.class.getName()).log(Level.SEVERE, e.getCause().getMessage(), e.getCause()); - System.exit(-1); // starting up UI failed - } catch (InterruptedException e) { - throw new RuntimeException(e); // won't happen - } + SwingUtilities.invokeAndWait(() -> { + try { + // use native laf an all platforms + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Exception e) { + Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e); + } + startUserInterface(args); + }); // preload media.types (when loaded during DnD it will freeze the UI for a few hundred milliseconds) MediaTypes.getDefault(); @@ -216,7 +209,7 @@ public class Main { System.exit(-1); } catch (Throwable e) { // unexpected error => dump stack - e.printStackTrace(); + Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Unexpected error during startup", e); System.exit(-1); } }