eviltester / blogcomments

1 stars 0 forks source link

2016/08/convert-breakpoint-into-conditional #3

Open utterances-bot opened 5 years ago

utterances-bot commented 5 years ago

How to convert a breakpoint into a conditional breakpoint in IntelliJ - EvilTester.com

TLDR; right click on a breakpoint and add code that returns a boolean to make it a conditional breakpoint Breakpoints are great. You find the section of code that you want to investigate. Click on the side of the screen to create a breakpoint. Run the code in debug and it stops where you want it. But what if you only wanted to stop on that breakpoint sometimes. What do you do?

https://eviltester.com/2016/08/convert-breakpoint-into-conditional.html

nickyw100 commented 5 years ago

A helpful post. Thank you. However, I've been having a had time stopping when a String is a specific value. I've tried key.equals("DIST_THIRD_PARTY_CITY") but it keeps complaining that there's a NullPointerException in the 'method'. (I know that the variable 'key' is not null. ) Grrr. Frustrating....

eviltester commented 5 years ago

Perhaps in the code, the key is null for some of the time. what happens if when you declare String key; you say String key=""; then it is never null and the conditional breakpoint might not complain?