Finding Hidden/Swallowed Exceptions in IntelliJ and Eclipse
When working with an event driven asynchronous application, it is difficult to troubleshoot Exceptions. It is difficult to figure out exactly why an Exception occurred and sometimes it is difficult to even determine that an Exception has occurred at all. I ran into this last problem when writing a GWT application; the client was swallowing all sorts of Exceptions. Here's how I was able to shed some light on spurious and hidden exceptions...
The essential piece of information to know is how your IDE/debugger supports creation of Exception breakpoints. I think most IDEs support this kind of thing but here's how IntelliJ and Eclipse do it.
IntelliJ
I use IntelliJ for development and it does this really well. After you start a debugging session, all you need to do is configure your breakpoints. Specifically you will be configuring the Exception Breakpoints tab. What you'll be telling the debugger to do is stop on any Exception that happens within the application.
You don't really want the debugger to stop on every single Exception though (try it and you'll see why you don't in a hurry). So what you need to do is configure the Class filters box. I used the following filters for my GWT application:
-java.* -sun.* -com.sun.* -javax.* -org.* -net.* -com.google.* -com.mysql.* -com.ibm.*
Eclipse
Eclipse also allows you to set Exception breakpoints. If you go to the Debug perspective and click the Breakpoints tab, the J! button is what you use to configure them. What I do is create a breakpoint based upon Exception, make sure to Suspend on Subclasses of this Exception and configure the Filters to exclude some packages.


