Newsletters   Subscriptions  Forums  Store  Media Kit  About Us  Contact  Search   Home 
fhg
Volume 4, Number 11 -- April 7, 2004

Using Exception Breakpoints in WDSc


Hey, David:

I have only been using WDSc (WebSphere Development Studio client) for a few weeks, so this may be an obvious question. How would you watch a variable in a Java program? Is there some way to trace a value or break when a certain condition is met? I hit F8 to run to my break point and hover the mouse over a variable to see its value. I just spent about two hours repeating this procedure to find out why my program was receiving a null pointer exception, even though I knew from the stack trace exactly what line the program was failing on.

--Neil


The debugger in WDSc is amazingly powerful. One useful feature that is easy to miss is the ability to set exception break points. An exception break point causes a running program to stop execution, allowing you to inspect variables and diagnose a problem. To add an exception breakpoint select Add Java Exception Breakpoint from the Run drop-down menu.

You can also add conditional break points and watch a value. Double-click the left border area of the line where you want your breakpoint. A blue bullet will appear, indicating that a breakpoint is set for the line. After setting the breakpoint, right-click the blue bullet and select Breakpoint Properties. . . . The Java Line Breakpoint Properties dialog will appear. Check the Enable Condition checkbox and enter a condition that resolves to a true Boolean value. That condition can be as simple as myString.equals("value"), or a complex condition. The code you enter in this box is nearly unlimited and will be aware of program variables in the executing program. I have even used this dialog to log values to the console, using System.err.println(myString).

Figure 1

The Java Line Breakpoint Properties dialog

You can also use the Java line breakpoint properties dialog to set a breakpoint when a value changes, by selecting the Suspend when value of condition changes radio button.

Please participate in our iSeries programming survey at
http://www.surveymonkey.com/s.asp?u=74193419903

Now that you know where to find these debug features, I bet your future debugging will go much more quickly.

--David

Sponsored By
GUILD COMPANIES


RPG Training $99


No Travel Expenses

No Scheduling Hassles

Fundamentals-Essentials-Advanced

Money-back Guarantee

Click here for course descriptions.


Editors: Howard Arner, Joe Hertvik, Ted Holt,
Shannon O'Donnell, Kevin Vandever
Managing Editor: Shannon Pastore
Contributing Editors: Raymond Everhart, G. Wayne Hawks,
Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

THIS ISSUE
SPONSORED BY:

Advanced Systems Concepts
Guild Companies
WorksRight Sofware
COMMON
Client Server Development


BACK ISSUES

TABLE OF
CONTENTS
Story 1

Story 2

Story 3

Story 4

Story 5



Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, 50 Park Terrace East, Suite 8F, New York, NY 10034
Privacy Statement