Errata for Patterns in Java, Volume 1

This page contains a list of errors found in my book, Patterns in Java, Volume 1. All of the errors list here are present in the first printing of the book. Some have been fixed in later printings. The publisher does not tell me what gets fixed when. As I learn of fixes being included in later printing, I will note them on this page.
 
 
First Found 
in Printing
Page Description of Error Fixed in 
Printing
1 20
The sentence that says 
UML provides a symbol that allows us to draw links that connect an indefinite number of projects. 
should say 
UML provides a symbol that allows us to draw links that connect an indefinite number of objects. 
?
1 23 .The lines 
    {concurrency = guarded} 
and 
    {concurrency = concurrent} 
are reversed. The line 
    {concurrency = concurrent} 
should appear first.
 ?
1 25 Figure 1.28 refers to a method named isisEmpty. The method name should be isEmpty. ?
1 57 There is a paragraph that begins 
  • Follow the Don't Talk to Strangers pattern...
It should say 
  • Follow the Law of Demeter pattern...
 ?
1 92 Paragraph Heading # 2 - Factory IE should be FactoryIF. 3
1 96 There is a line in a code listing that says 
 * @param factory The Factory object for creatig Encryption objects. 

The line should say 
 * @param factory The Factory object for creating Encryption objects.

?
1 97 In line 8 of the code listing at the top of the page, 
// interface EncryptionFactoryIF 
should be plain not bold 

The first line of the second code listing on the page should read 
public class EncryptionFactory implements EncryptionFactoryIF

 3
100 In Figure 5.5, the two classes at the bottom of the diagram should be labeled EnginolaMMU and EmberMMU rather than EnginolaCPU and EmberCPU  3
1 102 In figure 5.6, the class at the bottom right should be labeled Product2WidgetB rather than Product1WidgetB.  3
1 105 The code listing line 
class EmberFactory extends ArchitectureToolkit 
should say 
class EmberToolkit extends ArchitectureToolkit 

Further down the page, 
        private static final EmberFactory emberFactory 
           = new EmberFactory(); 
        private static EnginolaFactory enginolaFactory 
           = new EnginolaFactory(); 
should say 
        private static final EmberToolkit emberToolkit 
           = new EmberToolkit(); 
        private static final EnginolaToolkit enginolaToolkit 
           = new EnginolaToolkit();

3
1 106 The code listing line 
                return emberFactory; 
should say 
                return emberToolkit;
3
107
The paragraph that begins 
The MIMEParser class is a subclass of the MessageParser class that can...
should say 
The MIMEParser class is a subclass of the MessageParser class (a class invented for but not included in this example) that can...
3
1 108 In figure 5.7, the type of the parameter for the MIMEParser class’s parse  method should be MIMEMsg instead of MIMEMessage ?
1 114 The code listing line that says 
class MIMEParser { 
should say 
class MIMEParser extends MessageParser { 

The code listing line that says 
    bdy = nextHeader(); 
should say 
    bdy = nextBodyPart();

3
1 115 The code listing line that says 
    } // Consructor(String, String) 
should say 
    } // Consructor(String, String) 

The code listing line that says 
    Object getValue() { return value; } 
should say 
    Object getValue() { return value; }

3
1 125 The code listing lines 
                if (c instanceof Character) { 
                    mgr.addCharacter((Character)c); 
                } // if 
should include an additional line like this 
                if (c instanceof Character) { 
                    mgr.addCharacter((Character)c); 
                    objectCount++; 
                } // if
?
1 140 In the first paragraph under the “Code Example” heading, ConnectionImpl.ConnectionPool should be changed to ConnectionPool ?
1 148 In Figure 6.2, methods named createDataQueryImpl are shown as returning DataQueryIimpl. It should be shown  as returning DataQueryImplIF. ?
1 149 In figure 6.3, the class named DataQuery should be named Service.  It should look like this: 
?
1 152 There are some code listing lines that look like this: 
    private DataQueryFactoryIF factory; 

    public void setFactory(DataQueryFactoryIF myFactory) { 

They should look like this: 
    private static DataQueryFactoryIF factory; 

    public static void setFactory(DataQueryFactoryIF myFactory) {

?
1 163 Under the “Related Patterns” heading, in the Layered Architecture section, the words 
described in Volume 2
should be changed to 
described in [BMRSS96]
171 The direction of the aggregation in figure 6.11 is reversed. It should look like this: 
3
1 177 In Figure 7.1, the line showing that MyCopyFilter implements the CopyFilterIF interface should be dashed. The figure should look like this: 
?
1 178 In Figure 7.2, the line showing that DocumentCopyFilterAdapter implements the CopyFilterIF interface should be dashed. The figure should look like this: 

?
1 179 In Figure 7.3, the line showing Adapter implements TargetIF should be dashed. The figure should look like this: 
 
?
1 181 The parapgraph that begins 
1. Pass a reference to the client object
should have read 
1. Pass a reference to the adaptee objecct.
?
1 203 There is a reference to a related pattern named Layered Architecture Analysis. That reference and the rest of that paragraph should be deleted. ?
193 There are some paragraphs that say this: 
  1. There is a hierarchy for manufacturer-independent sensor classes shown with bold boxes—SimpleSensor, AveragingSensor, and StreamingSensor.

  2.  
  3. There is a parallel hierarchy of manufacturer specific classes shown in gray dark gray boxes—SimpleSenorImpl, AveragingSensorImpl, and StreamingSensorImpl.

  4.  
  5. There is a parallel hierarchy of interfaces, shown in light gray boxes that allow the manufacturer independent classes to remain independent of any manufacturer-specific classes
The paragraphs should say this: 
  1. There is a hierarchy for the manufacturer-independent sensor classes — SimpleSensor, AveragingSensor, and StreamingSensor.

  2.  
  3. There is a parallel hierarchy of manufacturer specific classes — SimpleSenorImpl, AveragingSensorImpl, and StreamingSensorImpl that  have names beginning with Eagle and Hawk.

  4.  
  5. There is a parallel hierarchy of interfaces that allow the manufacturer independent classes to remain independent of any manufacturer-specific classes — SimpleSenorImpl, AveragingSensorImpl, and StreamingSensorImpl.
 ?
1 211
There is a paragraph that begins 
Don't Talk to Strangers  A conceptual model that uses the Don't Talk to Strangers pattern (discussed in Volume 2) ...
The paragraph should say 
Law of Demeter  A conceptual model that uses the Law of Demeter  pattern (discussed in Volume 2) ...
?
1 216
The last sentence on the page begins with: 
The primary motivation for using the Façade pattern...
The sentence should begin with 
The primary  motivation for using the Flyweight pattern...
?
1 227
The sentence 
It implements the EnvironmentIF class.

should be deleted
?
1 244 The pair of words “DoorController interface” occur twice and should be replaced with “DoorControllerIF interface” 3
1 253 In figure 7.32, the association labeled Cache-objects-for has its navigation and label arrows reversed. It should look like this: 
?
1 254
Under the “Consequences” heading, there is a sentence that begins with 
If the CacheManager class is implemented as a subclass of the ObjectFetcher class...
It should begin with 
If the CacheManager class is implemented as a subclass of the ObjectCreater class...
?
1 260 In figure 7.33, the association labeled Fetches-employee-profiles-for has its navigation and label arrows reversed. It should look like this: 
?
1 261 There is a line of code that says 
                    cache.remove(newLink); 
It should say 
                    cache.remove(id); 
                    currentCacheSize--;
?
1 262 There are some lines of code that say 
                newLink.profile = emp; 
                newLink.next = mru; 
                newLink.previous = null; 
                mru = newLink; 
They should say 
                newLink.profile = emp; 
                newLink.next = mru; 
                mru.previous = newLink; 
                newLink.previous = null; 
                mru = newLink; 

There are some other lines of code that say 
        if (mru != foundLink) { 
            if (foundLink.previous != null) 
              foundLink.previous.next = foundLink.next; 
            if (foundLink.next != null) 
              foundLink.next.previous = foundLink.previous; 
            foundLink.previous = null; 
            foundLink.next = mru; 
            mru = foundLink; 
        } // if currentCacheSize > 1 
They should say 
        if (mru != foundLink) { 
            if ( foundLink == lru ) { 
              lru = foundLink.previous; 
              lru.next = null; 
            } // if lru 
            if (foundLink.previous != null) 
              foundLink.previous.next = foundLink.next; 
            if (foundLink.next != null) 
              foundLink.next.previous = foundLink.previous; 
            mru.previous = foundLink 
            foundLink.previous = null; 
            foundLink.next = mru; 
            mru = foundLink; 
        } // if mru 1= foundLink

?
1 271
The paragraph that begins 
The first version of Java, version 1.0, used the Chain of Command pattern to...
should say 
The first version of Java, version 1.0, used the Chain of Responsibility pattern to...
3
1 338
There is a line of code that looks like this: 
ObOut.writeObject(foo); 
The first 'o' should be lower case like this:
obOut.writeObject(foo);
?
1 339
There is a line in  acode example that looks like 
objectInputStream obIn = new ObjectInputStream(fin);
The first 'o' in that line should be capalized like this: 
ObjectInputStream obIn = new ObjectInputStream(fin);
There is a line of code that says 
import java.io.serializable;
It should say 
import java.io.Serializable;
?
1 341
The last code listing line on this page is formatted as text rather than code. Instead of being formatted like 
 } // readObject(ObjectInputStream)
it should be formatted like 
 } // readObject(ObjectInputStream)
?
1 359 There is a sentence that says 
The start method also creates an instance of the DirtyState class and assigns its variables notDirty, fileDirty, paramDirty and bothDirty to the corresponding subclass instances that it creates.
The sentence should say 
The start method also creates an instance of the DirtyState class.
Figure 2.21 should look like this: 
?
1 362 There are some code listing lines that look like this: 
    private final BothDirty  bothDirty  = new BothDirty(); 
    private final FileDirty  fileDirty  = new FileDirty(); 
    private final ParamDirty paramDirty = new ParamDirty(); 
    private final NotDirty   notDirty   = new NotDirty(); 

They should look like this 
    private final static BothDirty  bothDirty  = new BothDirty(); 
    private final static FileDirty  fileDirty  = new FileDirty(); 
    private final static ParamDirty paramDirty = new ParamDirty(); 
    private final static NotDirty   notDirty   = new NotDirty();

?
1 363 Change the listing line that says
    private class FileDirty extends DirtyState {
to 
    private static class FileDirty extends DirtyState {
?
1 368 There is a line of code that reads 
    warning.routeWarning msg); 
It should say 
    warning.routeWarning(msg);
?
1 382 There are two lines of a code listing that look like this 
        logonDialog = new LogonDialog(frame, 
                                      Log on to "+programName); 
they should look like this 
        logonDialog = new LogonDialog(frame, 
                                      "Log on to "+programName);
?
1 409
There is a sentence that begins with 
When the queue is empty, you want the get method to wait... 
It should begin with 
When the queue is empty, you want the pull method to wait...
?
1 411
There is a sentence that begins like this:
The call to foo will not return until a call to bar takes...
It should be formatted like this:
The call to foo will not return until a call to bar takes...
?
1 429 The first line of code on the page reads 
            waitingThreads.remove(0); 
That line should be deleted. 

There is a range of lines of code that read 
            runningThread = (Thread)waitingThreads.get(next); 
            synchronized (runningThread) { 
                runningThread.notifyAll(); 
            } // synchronized (runningThread) 
        } // if waitCount 
    } // done() 
Those lines of code should say 
            runningThread = (Thread)waitingThreads.get(next); 
        } // if waitCount 
        synchronized (runningThread) { 
            runningThread.notifyAll(); 
        } // synchronized (runningThread) 
    } // done()

?
1 443
There is a sentence that says
If the Queue object is empty, a Producer object that wants to get an object from it must wait until a consumer object puts an object in the Queue object.
It should say
If the Queue object is empty, a Consumer object that wants to get an object from it must wait until a Producer object puts an object in the Queue object.
?
1 438 There is a range of lines of code that says: 
                writeLockedThread = (Thread)waitingForWriteLock.get(0);  
                writeLockedThread.notifyAll();  
            } // if  
        } else if (Thread.currentThread() == writeLockedThread) {  
            if ( outstandingReadLocks==0  
                 && waitingForWriteLock.size()>0) {  
                writeLockedThread = (Thread)waitingForWriteLock.get(0);  
                writeLockedThread.notifyAll();   

It should say: 
                writeLockedThread = (Thread)waitingForWriteLock.get(0); 
                synchronized (writeLockedThread) { 
                    writeLockedThread.notifyAll(); 
                } // synchronized 
            } // if 
        } else if (Thread.currentThread() == writeLockedThread) { 
            if ( outstandingReadLocks==0 
                 && waitingForWriteLock.size()>0) { 
                writeLockedThread = (Thread)waitingForWriteLock.get(0); 
                synchronized (writeLockedThread) { 
                    writeLockedThread.notifyAll(); 
                } // synchronized

?
1 457
The first paragraph begins 
The CD-ROM contains the complete code for ...
It should say 
The CD-ROM contains the complete Java 1.2 code for ...
?