Java Reference
In-Depth Information
Using the PasswordException Classes and Subclasses
The purpose of creating the PasswordException class and its subclasses was
to allow a more specific identification of the kind of exception thrown so the
user program could take more appropriate action. Consequently, all methods in
the Password class that throw an Exception now should be modified to throw a
PasswordException.
Finding and Replacing Text in TextPad
Although the Password class is fairly small, as is typical for object-oriented
programs, it still may be difficult or tedious to find every place where a change
must be made simply by scrolling through the code. TextPad provides features
that can help in finding code to change and then replacing the code with new
code to make those changes quickly and accurately.
Figure 10-21 displays the modified code for the Password class. The follow-
ing steps that begin on page 632 find the code, throws Exception, and replace it
with the code, throws PasswordException, so that all throws of an Exception in
the Password class are changed to throws of a PasswordException.
FIGURE 10-21
 
Search WWH ::




Custom Search