Garner Press

Garner Press

Free UK Delivery on all orders!

OCEJWCD Study Companion: Errata

This errata page concerns:

If you believe you have seen an error in the book which is not listed below, please contact us so the author can review and publish the correction below if required.

Errors and Corrections

Last updated: 19th January 2013

PageLocationErrorCorrectionComments
xiiLine 3These are given in Appendix A of this bookThese can be found online at Oracle's website.Appendix A was removed in the 3rd Edition for compactness
29Lines 3-5the container has to manage applications in a 'sandbox'. On the server, these sandboxes are called containers.the server has to manage applications in a 'sandbox'. On the server, these sandboxes are called containers.Minor re-wording
82Q.9-10[No typographical/content error][No correction]Question number boxes need re-aligning
85Q.9 Exhibitresp.getWriter().write(title)[No correction]One reader has questioned that this should throw a NullPointerException; however, Java 7 API documentation for PrintWriter.write(String) states: If the argument is null then the string "null" is printed. This question is correct as written.
132Line 1thrown (see page 101)thrown (see page 104)Page mis-reference
1878th line from endubiqitous "Hello World!"ubiquitous "Hello World!"Minor spelling typo
188Line 5resp.flushBuffer();[Remove line entirely]Does not compile as flushBuffer() throws a checked IOException, but is not essential to the example. Note Line 4 is fine as PrintWriter.write() does not throw any checked exceptions.
200Q.3, Option CServletRequest.newAsync()ServletRequest.startAsync()By far the most reported error!
2675th line from endresp.sendError(HttpServletResponse. SC_REQUEST_ENTITY_TOO_LARGE);[Remove the bold typeface]Minor formatting error
2673rd line from end}} catch(Exception e) {}The extra catch clause is required as req.getPart("file1") throws checked IOException and ServletException
268Line 8if("yes".equals(req.getParameter("inspect")) {if("yes".equals(req.getParameter("inspect"))) {Single missing )
287Printed line 12 of full code exampleEnumSet<DispatcherType> types = new EnumSet<DispatcherTypes>();EnumSet<DispatcherType> types = new EnumSet<DispatcherType()>; Single character typo
290Q.4(choose one)(choose two)
291Q.5(choose one)(choose three)
291Q.6(choose two)(choose one)
291Q.7(choose one)(choose two)
291Q.8(choose one)(choose two)
293Q.16(choose one)(choose two)
293Q.16, Option CsetInitParam(String,String)setInitParameter(String,String)Worth noting that annotations and deployment descriptors use the "param" abbreviation, but the API method is the full word "parameter" - great for consistency!
295Q.3Correct answers: B,DCorrect answers: B,CThe text comment is correct
311Line 1em.query(em.createQuery(
311Line 8Writer w = resp.getWriter();PrintWriter w = resp.getWriter();Needed so the print() method in the next line is available.
311Line 11item.calculatePrice(4.5)item.calculatePrice(4.5f)4.5 will be double by default; float is needed
316Q.11(choose one)(choose three)
317Q.12(choose one)(choose three)