I am trying to debug a problem where a user clicks on the button and the UI just dies. I know, good luck.
The logs just end after the user clicks the button so i’m thinking there may be some exception/error that we are not logging. Maybe an OutOfMemoryError.
Any suggestions on how to proceed? to get more information. Java command setting etc.
Thanks for any help
- rich
Which version of java and what machine?
In any case, here’s the scoop: the event queue thread runs somewhat separately from the main thread. In Java < 5 there was a bug that made it difficult to capture events from that thread, so some exceptions just went away. In Java 5, there’s a new method
Thread.setDefaultUncaughtExceptionHandler()that will let you set up an exception handler for anything that might otherwise have gone uncaught. Add a handler there, and catch allThrowablesand log them.This is also a good hack for dealing with things you might otherwise call
System.exit()for, as well; have anormalExitThrowable; throw that anywhere you’d call exit in the GUI, and make sure all gets cleaned up.