TL;DR: Find the line where the exception occurs and then add a conditional breakpoint which checks the local variables for values that would trigger the exception.
In Eclipse, you can stop on any exception by using the menu Run -> “Add Java Exception Breakpoint…“.
That’s great but it doesn’t help when you want to stop on a certain exception on a certain line. It’s a big problem with code that uses exceptions for control flow – you could have thousands of those exceptions before you get to the one which you care about.
In my case, I had a NullPointerException
in java.util.concurrent.ConcurrentHashMap
:
public V get(Object key) { Node<K,V>[] tab; Node<K,V> e, p; int n, eh; K ek; int h = spread(key.hashCode()); <-------- key is null ...
I tried to add a conditional breakpoint here with the condition key == null
but Eclipse complained that it couldn’t compile the expression (probably missing debug information).
The method was called from Jetty’s ClassInheritanceHandler
, so I added a conditional breakpoint there.
That’s another reason to copy method results into local variables before using them.
I’m Not a Robot (Rant)
31. December, 2017Google’s “I’m not a robot” CAPTCHA is freaking me out.
I often spend minutes clicking stupid images only to be presented with more fucking images. It feels like it takes half an hour or more to just get the stupid thing to get out of the way so I can do whatever I came to do.
My main complaints:
Just seeing the box turns me off by now. I’m starting to avoid web sites that use this. Patreon is about the last one where I force myself to endure the pain so I can help people. The support guys were nice and supportive, but there is little that they can do.
Share this:
Like this: