Errata

Exploring Java

Errata for Exploring Java

Submit your own errata for this product.

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 62

The third code example now reads:

gc.setColor( blinkState ? Color.white : currentColor() );

It should read:

graphics.setColor( blinkState ? Color.white : currentColor() );

Anonymous   
Printed Page 121-122
There are some superfluous blank lines.

Anonymous   
Printed Page 121

The code in the middle reads:

ParseException( String desc ) {
super( desc ) };

I think the semicolon needs to be before the curly-brace. This it
would look nicer (and more consistent) if the curly-brace were moved
to the next line, aligned with the previous "P" in "ParseException".

Anonymous   
Printed Page 169
Code Sample 1

In the interface TextUpdateable, shouldn't the method receiveText() have
a return type? I tried compiling it and received an error. In fact I tried
compiling the whole code sample extending over to page 170 and also received
"return type required" errors for init() and sendText(). (I commented out
scrollText(), which I believe should be terminated with a semicolon instead
of a colon.)

The reason I'm classifying this as a reader question rather than a technical
mistake is that in looking through the errata I couldn't find any other
references to this code sample. Surely I'm not the first to find this? If
the code is correct and I just don't understand something about how callbacks
are supposed to work, please forgive my ignorance.

What should be the return types for receiveText() and sendText() in this
code sample?

Anonymous   
Printed Page 183
4th paragraph

The second and third sentences of the fourth paragraph on the page say,
"The body of Brain can see *anything* in the scope of
performBehavior()...This includes local variables of performBehavior(), and
its arguments". That's not correct. The body of Brain can see *only* the
local variables and arguments of performBehavior() that are labeled with
the final modifier.

Anonymous   
Printed Page 184
first example: closing brace for inner class isn't aligned

Anonymous   
Printed Page 187
bottom half of page uses javap utility, but javap isn't in

index. What is javap?? I'd also suggest mentioning the singlequotes
and explaining why you need them (and not doublequotes) with names
containing "$"..

Anonymous   
Printed Page 217
first paragraph: should the phrase "double and long primitive

types ... handled automatically" be "double and long primitive types
... handled atomically"?

Anonymous   
Printed Page 304
Third line: instead of "DataInputStream" it should be

"BufferedReader".

Anonymous   
Printed Page 329
You just said rmic MyServer, but the MyClient will run with

exception. You also need to do:

1) rmic MyClient
2) rmic StringEnumerator

since they are both extends java.rmi.server.UnicastRemoteObject

Anonymous   
Printed Page 360
I am using Netscape and when I try to cast a URL connection to a

HttpURLConnection, it fails in the browser and gives me a
ClassCastException. The program does run in the AppletViewer.
Is this an error with the book or a bug?

Anonymous   
Printed Page 403
The second paragraph begins

"In Figure 13-11 we have drawn..."

It should read:

"In Figure 13-10 we have drawn..."

Anonymous   
Printed Page 432
paragraph at bottom of page says init() starts by setting

layout manager, then it gets the image. The code seems to be different.

Anonymous   
Printed Page 446
the example code on page 446

seems like it might be mis-aligned at the middle of the page, between
the lines for "public int setValue()" and "public int getMaximum()".

Anonymous   
Printed Page 481
In the first code example, in the init() function, the

getFontMetrics call for the Component class should take a Font
object as an argument.

Therefore it seems wrong to me to pass smallFont into the getFontMetrics
function since smallFont is a FontMetrics object.

I tried it on my compiler (MS J++) and it won't compile.

Anonymous   
Printed Page 489
Line 11 currently reads:

``setColor''

It should read:

``g.setColor''

Anonymous   
Printed Page 489
Line 12 currently read:

``fillRect''

It should read:

``g.fillRect''

Anonymous   
Printed Page 526
para. 1, lines 1-2: "Drag a Juggler Bean ... into the workspace."

To me, "drag" means to point to the thing I want to drag, hold down the
left mouse button, move the mouse pointer to the place where I want to
drop the object, then release the button. That doesn't work.

I found the answer in the BDK documentation at BDK/doc/beanbox.html#drop:

Dropping beans onto the composition window

To add a bean to the composition window:

First click on the bean's name or icon in the left-hand ToolBox
window.

Then click on the location in the center composition window
where you want the new bean to appear.

The chosen bean will appear centered at the new location and
will become the current selected bean for editing.

Anonymous   
Printed Page 530
the second paragraph says "Grab two JellyBean beans...

Select the Bind Property option under the Edit menu." At this point, I
had grabbed two beans, put the first one to the left and the second one
to the right; the second bean was selected (had the slashed border
around it). Then the instructions say "now drag the rubber band over
to the second bean". I guess they mean the first bean?

Of course, you can call either bean the "first" or "second"; it doesn't
matter in this example. And some people might place the right-hand bean
first. But it was still a bit confusing, especially since Figure 18-5
shows the left-hand bean selected.

Anonymous   
Printed Page 532
para. 2, line -2, "The Bean Box should notify you that the value

cannot be changed."

I'm using the BDK 1.0, March 1998, on Solaris 2.5.1 (Generic May 1996).
What happened to me was a stack trace in my console window (the window
where I started BDK):

Property set failed
java.beans.PropertyVetoException: NO!
at sunw.demo.misc.Voter.vetoableChange(Voter.java:110)
at
tmp.sunw.beanbox.___Hookup_1501109cb1.vetoableChange(___Hookup_1501109cb1.java:15)
at
java.beans.VetoableChangeSupport.fireVetoableChange(VetoableChangeSupport.java:110)
at sunw.demo.jelly.JellyBean.setPriceInCents(JellyBean.java:74)
at sunw.beanbox.PropertyHookup.propertyChange(PropertyHookup.java:115)
at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:103)
at sunw.demo.jelly.JellyBean.setPriceInCents(JellyBean.java:79)
at sun.beanbox.PropertySheetPanel.wasModified(PropertySheet.java:369)
at sun.beanbox.PropertySheet.wasModified(PropertySheet.java:50)
at sun.beanbox.EditedAdaptor.propertyChange(EditedAdaptor.java:13)
at
java.beans.PropertyEditorSupport.firePropertyChange(PropertyEditorSupport.java:237)
at
java.beans.PropertyEditorSupport.setValue(PropertyEditorSupport.java:61)
at sun.beans.editors.IntEditor.setAsText(IntEditor.java:36)
at sun.beanbox.PropertyText.keyReleased(PropertyText.java:27)
at java.awt.Component.processKeyEvent(Component.java:2250)
at java.awt.Component.processEvent(Component.java:2138)
at java.awt.TextComponent.processEvent(TextComponent.java:398)
at java.awt.TextField.processEvent(TextField.java:387)
at java.awt.Component.dispatchEventImpl(Component.java:1764)
at java.awt.Component.dispatchEvent(Component.java:1704)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:63)

Maybe I did something wrong?? To make the connection, I clicked on the
Jelly Bean, chose "Events" from the "Edit" menu, and went from there.
But I was able to change the vetoAll property to "False", and an
exception wasn't thrown anymore when I changed the price. So I think
my connection worked okay.

and line -1, "If you sent the "vetoAll" property to "yes," you will be free
to change the price again.

That's wrong for two reasons, I think:

- The settings don't include "yes" on my Voter bean. Mine has
"True" and "False".

- The setting should be "False" (not "yes" or "True") to keep the
Voter bean from vetoing all changes.

Anonymous   
Printed Page 534
The jar command in the middle of page 534 has some problems, I think.

- I extracted the source files from the online archive. It puts all the
files into the magicbeans directory. But the jar command shown on
page 534 assumes that the manifest file is in the *parent* directory,
one level above the *.class files. Maybe this is a problem in the
online archive, but it's a little confusing anyway because the book
doesn't tell you to put the manifest file in the parent directory.

In the same way, the jar file is made in the parent directory (one
level above the magicbeans subdirectory). This stuff is obvious to a
UNIX hacker, but may not be to a Win95 person who's never seen a
command line. :-/

The command line I used (from the parent directory) was:

% jar cvmf magicbeans/magicbeans.manifest magicbeans.jar magicbeans/*.class

- The jar file doesn't include the gif file. That makes the command line
pretty long. It's even longer when the manifest file is in the
magicbeans subdirectory, where the online archive extracts it.

UNIX C-shell and bash users can run this command from the parent directory:

% jar cvfm magicbeans.jar magicbeans/{magicbeans.manifest,*.class,*.gif}

Anonymous   
Printed Page 539
end of second paragraph says that the property called

"alignment" can be set to 1, 2, or 3. That didn't seem true for me.
The default value I got after pasting in the bean was 0. I could change
it to 1 (which centered the text) or 2 (right-justified). A value of 3
gave an error that locked up the BeanBox (I couldn't close the error
message box that opened).

Anonymous