3 Answers
3

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):

Open the 'Breakpoints' window and go to the 'Exception Breakpoints' tab

Highlight and activate the 'Any exception' breakpoint

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.

this is the key, apparently! While testing it IDEA didn't remove the 'java.lang' bit, but it did put red squiggles under the expression and warned me that this cannot be converted to ClassNotFoundException. I just ignored it and it worked perfectly.
– Dan BerindeiJan 31 '12 at 11:55

Possibly fixed in IntelliJ 12, but as of IntelliJ 13/Android Studio, this works perfectly! Really glad I found this tip.
– Louis St-AmourNov 20 '13 at 16:19

For some reason I kept getting "failed to evaluate breakpoint expression" when I put the !ClassNotFoundException condition under the "any exception" breakpoint rules. I was able to work around it by creating a custom "any exception" breakpoint item though:

Open the breakpoints window from the debug view.

Uncheck "Any Exception" so we will not be stopping at any exception using the default item.

Click the + sign, click java exception breakpoints, check "Include Non-Project Classes", type "java.lang.Exception" in the box, select the result that shows up in the box.

Select the Exception item that is generated in the list (under "Any Exception"), and put

It's an exception breakpoint, so I can't right click on it...
– Dan BerindeiJun 20 '11 at 11:00

1

I tried your suggestion anyway, hoping there is an implicit variable called myException usable in exception breakpoint conditions, but it doesn't work.
– Dan BerindeiJun 20 '11 at 11:01

Can you not make it a Line Breakpoint? myException wasn't meant to be interpreted literally but as an exception you catch. Anyway, you can define class filter with Exception Breakpoints which should do a similar thing.
– mindasJun 20 '11 at 11:12

1

I realized myException was just a placeholder, but I was hoping you knew something that I didn't :) I guess I could put a line breakpoint in each of Throwable's constructors, but that be a little inconvenient in that I'd have to set the condition 4 times. AFAIK the class filters for Exception breakpoints are for the class the exception is thrown from, not for the class of the exception (and they rarely work, at least for me).
– Dan BerindeiJun 20 '11 at 13:46

Yeah, you're right (and I'm wrong) regarding class filter. Anyway, I don't think there is a way to achieve what you want using Exception Breakpoints, but you can always report an improvement request to IntelliJ guys :)
– mindasJun 20 '11 at 15:48