Pages

JDeveloper Debugging Tips (Watchpoints & Beep)

In a previous blog post I talked about scoping breakpoints for debugging purposes, next to scoping breakpoints JDeveloper has more interesting debugging features to offer.

I created a simple example to show both the watchpoint as well as the beep functionality. To illustrate this, I created a page with an inputText and a button, both bound to a backingBean. 

This  is the jsf code:
 
      
      
 
The code from the bean is also pretty straight forward:
   private String value = "value";

    public void setValue(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public void changeValue(ActionEvent actionEvent) {
        value += "!";
    }

Now imagine that I want to halt execution everytime the bean field value changes. I can simply right-click the field and choose ‘Toggle Watchpoint’:

This will show a nice sunglass instead of a breakpoint in the line gutter:


I also want to be informed when the getter of the value is called, however, I do not have the need to be redirected to JDeveloper and press F9 again to continue. I just want a signal that we have been inside the getValue() method, in this case a beeping sound.
To do this, you place a breakpoint in the getter, right-click on it and go to ‘Edit Breakpoint’.

Go to the Actions tab, in here unselect the ‘Halt Execution’ option and select the ‘Beep’ option. You will hear a beep when the breakpoint is reached, but it will not force you into JDeveloper.


If you run the page, you will hear a Beep whenever the getter is called, so you recieve a signal of this action. Whenever the field value is changed, it will take me into JDeveloper and halt the execution, this means it will halt execution in the method when I press the button on the screen, while there is no explicit breakpoint at this point in the code:

You can also see the old and new value in the log window: