Is It Possible To Automatically Change A Value Whilst Debugging?


There is a bug in an external library that I am using that causes a NullPointerException.

Therefore, I have put a conditional breakpoint that gets hit when the value is Null and I then modify the variable to be an empty Map.

The trouble is that this happens about 4 times each test and is tedious to set.

Is it possible to have IDEA change the variable to this empty map for  me each time the conditional breakpoint is hit?

Official comment

Yes sure, this is possible, just assign a new value in breakpoint's "Evaluate and log" field. Also you can unset "suspend" and the breakpoint will silently reset value when needed.

@Serge you sneaky monkey! You deleted your comment saying it wasn't possible! :)

I had started to use AOP before this answer came in. Talk about overkill!



Please sign in to leave a comment.