The errata list is a list of errors and their corrections that were found after the product was released.
The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.
Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update
Version |
Location |
Description |
Submitted by |
Date submitted |
Printed |
Page 38
At the bottom of page, the code seems incorrect |
tempAdapter1 = new TemperatureAdapter1();
tempAdapter2 = new TemperatureAdapter2();
it seems to be:
tempAdapter1 = new TemperatureAdapter1(theTemperature1);
tempAdapter2 = new TemperatureAdapter2(theTemperature2);
|
Anonymous |
|
Printed |
Page 49
adapter = new GenericButtonAdapter(this) |
The comment in your errata that ExampleApplet2 will not compile is NOT
correct in my version, since the GenericButtonAdapter constructor DOES
throw a ClassNotFoundException. See page 47. And it compiles just fine.
public GenericButtonAdapter(Object target)
throws ClassNotFoundException
However, I do get the following runtime error:
java.lang.NoClassDefFoundError: BeansBook/util/GenericButtonAdapter
at ExampleApplet2.init(ExampleApplet2.java:27)
at sun.applet.AppletPanel.run(AppletPanel.java:344)
at java.lang.Thread.run(Thread.java:484)
Since it compiles, I don't think it is a classpath error, and I am not sure
what the problem is. I am compiling the ExampleApplet2 in the Simulator
directory without a package statement. I would like to know a solution,
since this would be a very useful technique, if I could get it to work.
|
Anonymous |
|
Printed |
Page 49
code, catch block |
There seems to be an extraneous catch block in the init() method try block
that reads:
try
{
adapter = new GenericButtonAdapter(this);
adapter.registerActionEventHandler(b1, "handleB1");
adapter.registerActionEventHandler(b1, "handleB1");
adapter.registerActionEventHandler(b1, "handleB1");
}
catch (ClassNotFoundException e)
{
System.out.println(e);
}
catch (NoSuchMethodException e)
{
System.out.println(e);
}
Since the ClassNotFoundException is never thrown in GenericButtonAdapter
the code will not compile.
I would suggest the code should read as follows:
try
{
adapter = new GenericButtonAdapter(this);
adapter.registerActionEventHandler(b1, "handleB1");
adapter.registerActionEventHandler(b1, "handleB1");
adapter.registerActionEventHandler(b1, "handleB1");
}
catch (NoSuchMethodException e)
{
System.out.println(e);
}x
|
Anonymous |
|
Printed |
Page 69
Code example bottom listing |
The code example uses:
if (evt.getSource() == theTemperature &&
evt.getPropertyName() == "CurrentTemperature") { ....
correction,
if (evt.getSource() == theTemperature &&
evt.getPropertyName().equals("CurrentTemperature")) { ....
The first example is comparing references, not the actual values of the
strings.
Also, curious why all the add<Properties>/remove<Properties> methods are
synchronized, when the vector is already sychronized.
|
Anonymous |
|
Printed |
Page 75-76
Code Sample |
This example is different from the same example code that can be downloaded
from the oreilly web site. The download is missing the propertyChange
method (which of course means it will not compile as it implements
PropertyChangeListener). This is confusing to me as well, because it never
fires the propertyChange Event, so does fireVetoableChange do that
automatically?
|
Anonymous |
|
Printed |
Page 276
last line |
In the [5/00] printing it reads: java.beans.Instrospector class.
It should be java.beans.Introspector class.
The word Introspector is spelled incorrectly.
|
Anonymous |
|