What would happen if certain method invoked from EDT thread thew unchecked exception? Does it hold up responsiveness of GUI or what? Thank you
What would happen if certain method invoked from EDT thread thew unchecked exception? Does
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
By default, if the exception is not caught, the stack trace is written to the console output. The GUI as a whole does not become unresponsive (but, as trashgod commented, the particular component can remain in an unnatural-looking state), the EDT continues to work: Does the EDT restart or not when an exception is thrown?
The good practice is to set up an uncaught exception handler, because you want to know if something went wrong. Note that (depending on the Java version) this might function differently for the EDT than for other threads:
How can I detect when an Exception's been thrown globally in Java?
Note that the “sun.awt.exception.handler” trick, mentioned in many SO posts, is not necessary and does not work in Java 7. For Java 7 just use the standard Thread.setDefaultUncaughtExceptionHandler. Of course, if you use both mechanisms to register the exception handler, the code will work in all versions.