Errata

Java Examples in a Nutshell

Errata for Java Examples in a Nutshell

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. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page xiii
bottom of page

...in a the other books... -> ...in the other books

Anonymous   
Printed
Page 15
1st paragraph

"So, in this examples, once..."

should read

"So, in this example, once..."

Anonymous   
Printed
Page 27
first text paragraph

constructor that doesn'thing

should read:

constructor that doesn't do anything

Anonymous   
Printed
Page 48
first comment inside public class Delete

"it arguments" now reads "its arguments."

Anonymous    Jan 01, 2001
Printed
Page 55
bottom

...creates and display... -> ...creates and displays...

Anonymous   
Printed
Page 74
last comment on page

...main() method create... now reads ...main() method creates...

Anonymous    May 01, 2001
Printed
Page 78
comment before scheduledExecution()

When it... now reads When is...

Anonymous    May 01, 2001
Printed
Page 78
comment before run()

...that code that... now reads ...code that...

Anonymous    May 01, 2001
Printed
Page 78
first comment in class Timer

...to sort the task by... now reads ...to sort the tasks by...

Anonymous    May 01, 2001
Printed
Page 80
middle of page

"This flag is will be set" now reads "This flag is set".

Anonymous    May 01, 2001
Printed
Page 111
top of page

It reads a line the client... now reads It reads a line from the client...

Anonymous    May 01, 2001
Printed
Page 112
bottom of page

...loop command loop... now reads ...command loop...

Anonymous    May 01, 2001
Printed
Page 114
first comment

The thread that invoke... now reads The thread that invokes...

Anonymous    May 01, 2001
Printed
Page 131
last comment in create()

No prepare... now reads Now prepare...

Anonymous    May 01, 2001
Printed
Page 138-139
This method uses uses Cipher... now reads This method uses Cipher...

Anonymous    May 01, 2001
Printed
Page 145
middle of page

...program just create... now reads ...program just creates...

Anonymous    May 01, 2001
Printed
Page 149
top of page

...DateFormat object... -> ...DateFormat objects...

Anonymous   
Printed
Page 153
middle of 4th paragraph

...a class the defines... -> ...a class that defines...

Anonymous   
Printed
Page 171
top of page

...and them from the other one... now reads ...and read them from the other
one...

Anonymous    May 01, 2001
Printed
Page 172
middle of page

...for important the security reasons... -> ...for the important security
reasons...

Anonymous   
Printed
Page 173
second paragraph

...GUI component component... now reads ...GUI component...

Anonymous    May 01, 2001
Printed
Page 205
top of page

ScriblePanel now reads ScribblePanel

Anonymous    May 01, 2001
Printed
Page 208
2nd paragraph

ListSelection Listener now reads ListSelectionListener

Anonymous    May 01, 2001
Printed
Page 240
reload method in WebBrowser.java

Replace the reload() method with this:

/** Reload the current page in the history list */
public void reload() {
if (currentHistoryPage != -1) {
// We can't reload the current document, so display a blank page
textPane.setDocument(new javax.swing.text.html.HTMLDocument());
// Now re-visit the current URL
visit((URL)history.get(currentHistoryPage));
}
}

Anonymous   
Printed
Page 259
comment before AppletMenuBar constructor

...popup up... now reads ...popup...

and:

arra now reads array

Anonymous    May 01, 2001
Printed
Page 271
first paragraph

knruow now reads know

Anonymous    May 01, 2001
Printed
Page 350
ScribbleDragAndDrop.java example

comment out the code starting with

// Choose a cursor based on the type of the drag the user initiated
Cursor cursor

End the comment after the switch statement.

Then, near the bottom of the page, there are two calls to startDrag().
In each one, replace "cursor" with "null".

By passing null instead of a cursor, the system will automatically
supply a default cursor, and will automatically upated it as needed if
the drop action changes during the drag.

Anonymous   
Printed
Page 351
last method call on the page

If you try the example using the book's code the Drag and Drop always results in a Move, not a Copy.
This is because the drop method needs to give a feedback as to which drop action was performed.
The method DropTargetDropEvent.acceptDrop needs to be passed the correct action (and not ACTION_COPY_OR_MOVE).

For instance: e.acceptDrop(e.getDropAction());

Anonymous   
Printed
Page 401
Example 16-2:

/**
* This hashtable stores all open accounts and maps from account name
* to Account object
**/

now reads:

/**
* This hashtable stores all open accounts and maps from account name
* to Account object. Methods that use this object are synchronized
* to prevent concurrent access by more than one thread.
**/

Anonymous    May 01, 2001
Printed
Page 402
Example 16-2

/**
* This internal method is not a remote method. Given a name and password
* it checks to see if an account with that name and password exists. If
* so, it returns the Account object. Otherwise, it throws an exception.
**/
Account verify(String name, String password) throws BankingException {
synchronized(accounts) {
Account acct = (Account)accounts.get(name);
if (acct == null) throw new BankingException("No such account");
if (!password.equals(acct.password))
throw new BankingException("Invalid password");
return acct;
}
}

now reads:

/**
* This internal method is not a remote method. Given a name and password
* it checks to see if an account with that name and password exists. If
* so, it returns the Account object. Otherwise, it throws an exception.
* This method is synchronized because it uses the accounts hashtable.
**/
synchronized Account verify(String name, String password) throws
BankingException {
Account acct = (Account)accounts.get(name);
if (acct == null) throw new BankingException("No such account");
if (!password.equals(acct.password))
throw new BankingException("Invalid password");
return acct;
}

Anonymous    May 01, 2001
Printed
Page 441
2nd paragraph

...iterates though the list... -> ...iterates through the list...

Anonymous   
Printed
Page 458
bottom of page

Hans Bersten now reads Hans Bergsten

Anonymous    May 01, 2001
Printed
Page 467
example code before "Database Access with Servlets"

<param name='counter' value='test.shtml'>

now reads:

<param name='counter' value='test.shtml'></param>

Anonymous    May 01, 2001
Printed
Page 513
last comment

...mapping in in... now reads ...mapping in...

Anonymous    May 01, 2001