How do you debug exceptions?

Hi

I'm debugging an interactive application. The code throws different exceptions when something goes wrong. This means that I usually like to have an exception breakpoint that breaks on any exception. But when I launch the application with that breakpoint enabled, about 30 or 40 exceptions are thrown and caught inside java.util.zip.ZipFile and sun.misc.URLClassPath and the like.

Am I doing something wrong? Or is there a more effective way to debug code that throws exceptions than with a catch-all breakpoint? I'm very used to this approach from other languages and programming environments, so it may just be my habits that get in my way here.

Im using IntelliJ IDEA 9.0.3 on Mac OS X 10.6.4

Thanks for any input!
Michael

2 comments
Comment actions Permalink

In the Breakoints window (Run -> View Breakpoints) you can control which exceptions cause a break into the debugger.

If the breakpoint you need to catch is among those that occur frequenly during start-up, you can make the breakpoint conditional or just keep it disabled until you're into the main loop of your application.


Randall Schulz

0
Comment actions Permalink

I was afraid of that. This limitation makes it cumbersome when quickly testing some behavior of a library as I don't know beforehand which exceptions and where they will be thrown. This way, it's also very frustrating for users new to Java or programming.

For anyone with the same problem, there is a feature request [0] trying to improve this.

[0]: http://youtrack.jetbrains.net/issue/IDEA-12111

Thanks
Michael

0

Please sign in to leave a comment.