Java Reference
In-Depth Information
to finding the source of problems stemming from a Throwable condition deep in
the bowels of your code, without the fuss of having to track down the exact source
of the problem yourself. (What can we say? We're as lazy as the next guys.)
Breaking when a certain exception is thrown
Because of their global nature, you must use the Breakpoints dialog to create
exception breakpoints. Select the Exception Breakpoints tab, and click the Add
button to create a new breakpoint. You're presented with a dialog for selecting the
exception you wish to break on. You can select any Throwable class from your
Classpath. Once a breakpoint is set for a particular type of exception, its action is
triggered when the exception is thrown anywhere in the code. If this is too aggres-
sive for you, you can narrow the scope through the use of class filters.
A very handy feature is the Any Exception option of the Breakpoints
dialog. It's a global option that can't be removed, only disabled. Activat-
ing this option breaks the execution of the application at any point
where it causes an exception, even if no breakpoint is explicitly set for
that exception. Using Any Exception quickly illustrates any exception
paths in the application's execution.
TIP
Differentiating between caught and uncaught exceptions
The Notifications option group for exception breakpoints provides options for
responding to caught and uncaught exceptions. By selecting some combination
of these two options, you can control the type of exceptional condition that
should trigger this breakpoint. If a box is deselected, exceptions in that situation
won't trigger the debugger action.
6.2.5
Working with field watchpoints
Field watchpoints allow you to target your debugging search to specific instance
variables. For example, if at the end of a complicated process you're ending up
with an obviously wrong value on one of your fields, then setting up a field watch-
point may be the quickest way to determine the origin of the fault.
Adding a field watchpoint through the Breakpoints configuration window
Typically, you set up a field watchpoint from the editor when the caret is on the
line of the field declaration. Select Run | Toggle Field Watchpoint from the main
menu, or Alt+Click the gutter area next to that line. You can also set a field
watchpoint through the Breakpoints dialog. Select the Run | View Breakpoints
 
 
 
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search