Errata

Java EE 7 Essentials

Errata for Java EE 7 Essentials

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
chapter 16 > Show Booking > step 6

getTheaterId() should be getTheater()

Note from the Author or Editor:
PDF, Page 305, second code fragment

Change "getTheaterId" to "getTheater".

Enric Jaen  Apr 04, 2015 
Printed,
Page 16
United States

The doFilter() method parameters are incorrect.
The book shows only HttpServletRequest and HttpServletResponse, but it omits the third parameter FilterChain.

Also, I think there should be a bit of explanation that if you want to continue the processing, call FilterChain.doFilter(), whereas if you want to terminate the chain, don't call it.

Note from the Author or Editor:
Change

public void doFilter(HttpServletRequest request, HttpServletResponse response)

to

public void doFilter(HttpServletRequest request, HttpServletResponse response,
FilterChain chain)

Also add the following text at the end of 3rd para:

The parameter `chain` is used to continue the processing through the chain by calling `FilterChain.doFilter()` method. If this method is not called then the filters after this filter in the chain are not called.

Victor J Grazi  Dec 25, 2013 
PDF
Page 17
1st paragraph

At the end of 4th line change

ServletRegistration.Dynamic

to

FilterRegistration.Dynamic

Note from the Author or Editor:
Page 17, 1st para

At the end of 4th line change

ServletRegistration.Dynamic

to

FilterRegistration.Dynamic

Mohsen Ekhtiari  Oct 29, 2014 
Printed
Page 21
United States

at the end of the fourth line, the word startAsync spills onto the next line after the startA...sync. Confusing, the whole word should be moved to the new line!

Note from the Author or Editor:
This recommended change would simplify reading the sentence and should be accommodated.

Victor J Grazi  Dec 25, 2013 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 48
United States

Change

<h:inputText value="#{user.name}" id="name">
<f:validateLength min="1" maximum="10"/>
</h:inputText>

to

<h:inputText value="#{user.name}" id="name">
<f:validateLength minimum="1" maximum="10"/>
</h:inputText>

"min" to "minimum"

Note from the Author or Editor:
Found this errata when reviewing the book, confirming the change.

Arun Gupta  Oct 02, 2013 
Printed
Page 64
Last paragraph

inversion of "HTML" and "usage" section for h:outputLabel

Note from the Author or Editor:
Page 64, h:outputLabel block (towards the end of the page)

Swap the code fragments under Usage and HTML. The updated text should look like:

Usage:

<h:outputLabel
for="inputTextId"
value="myLabel"/>
<h:inputText
id="inputTextId"
value="myInputText"/>

HTML:

<label
for="inputTextId">
</label>
<input
id="inputTextId"
type="text"
name="inputTextId"
value="myInputText" />

Bertrand DONNET  Oct 22, 2013 
Printed
Page 76
United States

Java code will not compile (class implements wrong interface)

class MyCompletionCallback implements CompletionCallback {
public void onDisconect(AsyncReponse ar) {
....
}
}

This class must implement ConnectionCallback.

Note from the Author or Editor:
On page 76, second code fragment, please change "implements CompletionCallback" to "implements ConnectionCallback".

Raymond Naseef  Jan 14, 2014 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 77
Code Fragment

Change

@POST
@Path("create")
@Consumes("application/x-www-form-urlencoded")
public Order createOrder(@FormParam("id")int id,
@FormParam("name")String name) {
Order order = new Order();
order.setId(id);
order.setName(name);
return order;
}

to

@POST
@Path("create")
@Consumes("application/x-www-form-urlencoded")
@Produces("application/xml")
public Order createOrder(@FormParam("id")int id,
@FormParam("name")String name) {
Order order = new Order();
order.setId(id);
order.setName(name);
return order;
}

Add @Produces

Note from the Author or Editor:
Found this errata when reviewing the book, confirming the change.

Arun Gupta  Oct 02, 2013 
PDF
Page 78
5th paragraph after "curl -i -X DELETE..."

the sencence for DELETE:
The content method parameter will have the value New Order.

I think this is a wrong copy from the explaination after "curl -i -X PUT ..."

Delete request doesn't have parameter.

Note from the Author or Editor:
Page 78, 5th paragraph after "curl -i -X DELETE..."

Please remove "The content method parameter will have the value New Order." paragraph.

Han Lu  Jun 08, 2014 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 80
Code fragment

Change "may be consumed by a resource method:" to "may be produced by a resource method:".

Change

@Consumes({"application/xml; qs=0.75", "application/json; qs=1"})

to

@Produces({"application/xml; qs=0.75", "application/json; qs=1"})

Note from the Author or Editor:
Found this errata when reviewing the book, confirming the change.

Arun Gupta  Oct 02, 2013 
PDF
Page 83
1st listing

For the first listing - implemented interface should be changed from "MessageBodyReader<Order>" to "MessageBodyWriter<Order>".

Note from the Author or Editor:
In the first code fragment, MessageBodyReader should be changed to MessageBodyWriter.

Vasily Sudakov  May 08, 2017 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 88
United States

Change the code from:

@Path("{id}")&#8232;
public Order getOrder(@PathParam("id")int id) {
Order order = null;
&#8232;if (order == null) {
throw new OrderNotFoundException(id); }
//. . .
return order; &#8232;}

TO

@Path("{id}")&#8232;
public Order getOrder(@PathParam("id")int id) {
Order order = findOrder(id);&#8232;
if (order == null) {
throw new OrderNotFoundException(id); }
//. . .
return order; &#8232;}

Note from the Author or Editor:
Found this errata when reviewing the book, confirming the change.

Change


@Path("{id}")
public Order getOrder(@PathParam("id")int id) {
Order order = null;
if (order == null) {
throw new OrderNotFoundException(id);
}
//. . .
return order;
}

to

@Path("{id}")
public Order getOrder(@PathParam("id")int id) {
Order order = findOrder(id);
if (order == null) {
throw new OrderNotFoundException(id);
}
//. . .
return order;
}

Arun Gupta  Oct 02, 2013 
Printed
Page 88
getOrder code in the errata

In the errata for this code fragment, I see what looks to be markup symbols ampersand poundsign 8232 (&#8232;) which are not visible on the book printed page.

They also seem unrelated to the error.

They will generate syntax errors when compiling the code as changed by the errata instructions.

Note from the Author or Editor:
Seems like a copy/paste error, updated the errata with the suggested code.

Gerry Matte  May 16, 2014 
PDF
Page 93
1st paragraph

Is that the "outbound response" should be "inbound response"?

Note from the Author or Editor:
Page 93, 1st para

Please change "outbound response" to "inbound response".

Han Lu  Jun 08, 2014 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 94
Code fragment

Add

private String email;

between

private String lastName; and
@FormParam("email")

Note from the Author or Editor:
Found this errata when reviewing the book, confirming the change.

Arun Gupta  Oct 02, 2013 
Printed,
Page 113
United States

The list of events is mentioned, but nowhere in the book does it tell you that there is a JsonParser.Event enum containing these values.

Note from the Author or Editor:
Add the following text right before "The parser generates START_OBJECT and END_OBJECT..."

All these types are defined in JsonParser.Event enum.

This will be added as a new para.

Victor Grazi  Dec 28, 2013 
Printed,
Page 116
United States

JsonReader can also be created from Reader:
But then the code shows instead that a JsonParser (i.e. not s JsonReader) can be created from Reader.
But then the next line says:
This code shows how to create a Parser from a StringReader.

Very confusing

Then, to make matters even more confusing, a few lines down it gives examples:

JsonReader parser1 = factory.createReader(...)
JsonReader parser2 = factory.createReader(...)

Shouldn't this say
JsonReader reader1 = factory.createReader(...)
JsonReader reader2 = factory.createReader(...)

Note from the Author or Editor:
On page 116, change

--
JsonReader can also be created from Reader:

JsonParser parser = Json.createParser(new StringReader(...));

This code shows how to create a parser from a StringReader.
You can create multiple parser instances using JsonReaderFactory:

JsonReaderFactory factory = Json.createReaderFactory(null); JsonReader parser1 = factory.createReader(...);
JsonReader parser2 = factory.createReader(...);
--

to

--
JsonReader can also be created from Reader:

JsonReader reader = Json.createReader(new StringReader(...));

This code shows how to create a reader from a StringReader.
You can create multiple reader instances using JsonReaderFactory:

JsonReaderFactory factory = Json.createReaderFactory(null); JsonReader reader1 = factory.createReader(...);
JsonReader reader2 = factory.createReader(...);
--

Victor Grazi  Dec 28, 2013 
PDF
Page 139
last line

message should be myMessage

Note from the Author or Editor:
Please change "message" to "myMessage" in the last line on page 139.

Han Lu  Jun 08, 2014 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 146
Code Fragment

Change

public ShoppingCart() {

to

public Cart() {

Note from the Author or Editor:
Found this errata when reviewing the book, confirming the change.

Arun Gupta  Oct 02, 2013 
Printed
Page 148
United States

Misspelled: acivation [activation]

Note from the Author or Editor:
Page 148, please change "acivation" to "activation"

Raymond Naseef  Jan 14, 2014 
Printed
Page 161
United States

Table 8-3 mistake with time (20 = 8pm, not 10pm)

Hour=?1,2,20? => 1 am, 2 am, and 10 pm on all days of the year

Note from the Author or Editor:
Page 161, Table 8-3, first row, second column

Change "10 pm" to "8 pm".

Raymond Naseef  Jan 14, 2014 
Printed
Page 180
United States

to a conversation unike [unlike]

Note from the Author or Editor:
On page 180, please change "unike" to "unlike"

Raymond Naseef  Jan 14, 2014 
Printed
Page 194
1st sentence under "Schedule Tasks"

Class ScheduledExecutorService does not include its package naming, better as:
java.util.concurrent.ScheduledExecutorService

In my opinion, section title should be "Scheduled Tasks" or "Scheduling Tasks".

Note from the Author or Editor:
Page 194, 1st sentence under "Schedule Tasks"

Change "ScheduledExecutorService" to "java.util.concurrent.ScheduledExecutorService".

Change the section title to "Scheduled Tasks".

Raymond Naseef  Feb 15, 2014 
Printed
Page 197
Java code after bullet near top of the page

This bullet talks about "scheduleWithFixedDelay()", then the code is same as code from prior bullet, with method "scheduleAtFixedRate()".

Also, paragraph after the code describes its behavior, and that seems to be describing the method in the code. Both the code and following description should match the method mentioned in the bullet.

Note from the Author or Editor:
Page 197

Change the code:

ScheduledFuture<?> f = executor
.scheduleAtFixedRate(new MyRunnableTask(5),
2,
3,
TimeUnit.SECONDS);

to

ScheduledFuture<?> f = executor
.scheduleWithFixedDelay(new MyRunnableTask(5),
2,
3,
TimeUnit.SECONDS);

No change needed in the paragraph.

Raymond Naseef  Feb 15, 2014 
Printed
Page 197
1st sentence under "Managed Threads"

To be consistent with prior sections, would be best to mention the EE class "ManagedThreadFactory" parent:

Java.util.concurrent.ThreadFactory

Note from the Author or Editor:
Page 197, change the first para under "Managed Threads" to:

javax.enterprise.concurrent.ManagedThreadFactory provides a managed version of java.util.concurrent.ThreadFactory and can be used to create managed threads for execution in a Java EE environment.

Raymond Naseef  Feb 15, 2014 
Printed
Page 216
4th paragraph

You can change the timeout value ... with the begin method:

should become

You can change the timeout value ... with the setTransactionTimeout method:

Note from the Author or Editor:
Page 216, 4th paragraph

"with the begin method"

should be changed to:

"with the setTransactionTimeout method"

Stefaan Neyts  Oct 27, 2014 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 286
Code Fragment

Change

<h:commandButton id="back" value="Back" action="booking" />

to

<h:commandButton id="back" value="Back" action="booking" immediate="true"/>

Note from the Author or Editor:
Found this errata when reviewing the book, confirming the change.

Arun Gupta  Oct 02, 2013 
Printed
Page 290
First and second paragraphs

Screenshots are inverted

Note from the Author or Editor:
Figure 16-13 and 16-14 need to be swapped, with exact same titles.

Bertrand DONNET  Oct 25, 2013