I'd like to run my test suite in the debugger and break on any unexpected exception, but the Java classloaders throw lots of ClassNotFoundExceptions during normal operation.
So it would be nice if I could create an exception breakpoint that ignores ClassNotFoundExceptions and stops on everything else.
Remove breakpoints For non-exception breakpoints: click the breakpoint in the gutter. For all breakpoints: from the main menu, select Run | View Breakpoints Ctrl+Shift+F8 , select the breakpoint, and click Remove Delete .
Add a condition to a breakpoint when debugging. Right-click on a breakpoint to configure its behavior: for instance, you can add a condition so that the execution will only be stopped when that condition is met.
This answer is almost the same as that of Mindas, but the details were enough for me to ignore his suggestion the first time around, and bother the Intellij support guys/girls (thanks Serge and Eugene):
Activate only the 'Condition' Condition and type in the following:
!(this instanceof java.lang.ClassNotFoundException)
IDEA will remove 'java.lang' immediately (version 11.01), but it is required for this solution to work. If you don't use that, you will get a ClassNotFound popup box (irony oh irony).
I did find out that a lot of 'standard' libraries throw exceptions in their normal flow of operations. When you successfully ignore the ClassNotFoundException's, you will find that others suddenly appear. Nothing is ever easy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With