* simplify error handling
This commit is contained in:
parent
d647315dd8
commit
79a0dacdbc
|
@ -173,22 +173,15 @@ public class Main {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GUI mode => start user interface
|
// GUI mode => start user interface
|
||||||
try {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
try {
|
||||||
try {
|
// use native laf an all platforms
|
||||||
// use native laf an all platforms
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e);
|
||||||
Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e);
|
}
|
||||||
}
|
startUserInterface(args);
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// preload media.types (when loaded during DnD it will freeze the UI for a few hundred milliseconds)
|
// preload media.types (when loaded during DnD it will freeze the UI for a few hundred milliseconds)
|
||||||
MediaTypes.getDefault();
|
MediaTypes.getDefault();
|
||||||
|
@ -216,7 +209,7 @@ public class Main {
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// unexpected error => dump stack
|
// unexpected error => dump stack
|
||||||
e.printStackTrace();
|
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Unexpected error during startup", e);
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue