• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A problem with the run method of java.awt.EventDispatchThread

 
Alejandro Barrero
Ranch Hand
Posts: 335
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some methods in my program throw Exceptions that extend RuntimeException (I don't want to catch them), but the program is executing the run method of java.awt.EventDispatchThread repeatedly (the program would not terminate). I am using Java 1.6. My code is simple:

When the exception is thrown in MyEclipse, running the debugger, the program keeps breaking in the run method of java.awt.EventDispatchThread. Without the debugger, the application never opens.
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you get an exception then you should find the cause (from the stack trace) and solve it.
But I think that using an unchecked exception instead of a checked exception just so you won't have to catch it is bad design. If the exception comes from some outside-world environment where you don't have much control over (like the file system, the network, a database), a checked exception is really the way to go. Unchecked exceptions should be used if you can prevent them with some checks.
 
Alejandro Barrero
Ranch Hand
Posts: 335
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob. I know exactly what is the cause of the exception and I am using an UncaughtExceptionHandler, but it will only be triggered if the exception makes the program terminate. This is my actual problem, but I didn't want to dwell on it because the real issue is that the exception is triggering the run method of java.awt.EventDispatchThread repeatedly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic