Errata

Java Servlet Programming

Errata for Java Servlet Programming

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 1
Multipart classes

I'm getting an IOException: Corrupt form data: no leading boundary, when I
use the MultipartParser, and paste any word document piece into a textarea
in my form. I can't determine what characters are causing this. Do you have
any ideas? I would like to try to filter out the characters on the client
side to get around the bug. The form works great when I type in text by hand.

Anonymous   
Printed Page 29
Example 2-4

The Server Side Include that prints the Current time in three different
places doesnot work..All the three servlet tags in the .shtml file that
make a call to the Currenttime servlet displays only the system current
time...the problem is with the <param name=zone >
This parameter name "zone" doesnot take the value specified in the value
attribute of the tag..it simply shows null..

If the order of the servlet tags is changed...i.e if i put the tag
<servlet code=CurrentTime>
<param name=zone value=GMT>
</servlet> first and then the rest two...the param name =zone throughout
shows the value as GMT...

Anonymous   
Printed Page 41
3rd paragraph under the heading "implements"

The end of the second sentence reads:

... or given through multiple import directives.

It should read:

... or given through multiple implements directives.

Anonymous   
Printed Page 45
paragraph 5, first sentence.

The first sentence reads:

Parameters can be passed to a bean as a list using a <PARAM> tags ...

The word "a" before the <PARAM> tag should be removed.

Parameters can be passed to a bean as a list using <PARAM> tags ...

Anonymous   
Printed Page 84
3rd Paragraph - "Each access to a servlet...."

I am having a bit of trouble with the following information:

"Each access to a servlet can have any number of request parameters
associated with it."

I have a substantially large form with a a large number of
parameters. All of this data is required for the servlet to process into
XML data.

I am calling my servlet from an HTML page as follows:
<FORM METHOD=GET ACTION="..servletsECreditServlet">

It appears that the query string is being truncated at 2048
characters. The statement in the book would appear to be bit
misleading. I am using JDeveloper and testing/debugging my form/servlet
using JDeveloper's included web server. Is this a limitation of this
development software?

How can I handle a query string longer than 2048 chars?

Anonymous   
Printed Page 112
Example 4-18

The MultipartRequest class will not handle forms that have multi-select
elements. All those element will be the last value selected no matter what
the user selects if the MultipartRequest is used as is. The value in the
parameters Hashtable should be set to a Vector so that all the selected
items a user selects in a multi-select element are stored.

Anonymous   
Printed Page 112
MultipartReqeuest class

I think the verion of MultipartRequest.getParameter(String name) in
cos-23jan2001.zip download has a bug in it.

public String getParameter(String name) {
try {
Vector values = (Vector)parameters.get(name);
if (values == null || values.size() == 0) {
return null;
}
String value = (String)values.elementAt(values.size() - 1);

// I think it should include the following statement to achieve the
// desired result.
if (value.equals("")) return null;

return value;
}
catch (Exception e) {
return null;
}
}

Anonymous   
Printed Page 130
Let's look...

htmkKona is apparently no longer available for free evaluation.

Anonymous   
Printed Page 220
About the Security (Chapter 08), there's nothing to show me how for

example to set first and retrieve after Customers username and password.

The only thing that has been shown is a very poor hashtable inside a
servlet not always well understood. I think that it'd be better to give
examples for all the book is talking about.

The author said on the 8th chapter, that it's easy to make servlet that
looks about user authentification (CustomAuth.java file) and he says that
someone can change the hashtable with another mechanism like an external
file or database. I'd like to know how.

Anonymous   
Printed Page 286
example 9-8

Example ConnectionPool.java (chapter 9) used java.sql.Connection (further, just Connection) as a Hastable key. The problem here is that Connection is an interface without any commitment on hasCode() and equals() (unlike Map interface) and the implementation is completely free on how to implement them or if implement them at all. On the other hand, a key must have properly designed hashCode() and equals() which is in the basics of Java. This worked in your example only because Connection implementation did not override these methods and inherited them from Object (their behavior is documented for Object class). It is difficult to say how efficient Object's hashCode() is in this case but equals() works only because the same instance of Connection is used to both put() and get() and Object's equals() does identity equality. If the methods are overriden and invariants depend on the state of Connection it will fail.

I think that the example has to be completly rewritten using some String as a key in the Hashtable. Or use decoration pattern and export all methods of Connection, make the class final. In this case it will always inherit hashCode() and equals() from Object and will always work at least as before no matter how Connection is implemented.

Boris Shukhat  Jul 31, 2011 
Printed Page 289-291
The entire class

I have tried to use your HttpMessage class to POST
data to a URL that is not a servlet, but rather
a PERL cgi script. I cannot get this to work,
for some reason it is ignoring the name=value
pairs sent in the request. The response that is
sent back is correct, except that it doesnt contain
the name value pairs.

The get methods contained in the class work well,
however it is the POST methods that I need to use.

Anonymous