Errata

Java Network Programming

Errata for Java Network 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
PDF Page 33
2nd paragraph

The book says that read byte arrays from InputStream will immediately return 0 if the underlying network buffer is empty. But I believe that is not true. The read method will block until there are some data obtained from the local network buffer. I checked the source code of SocketInputStream of jdk1.8.0_91. It will return 0 immediately only if the length of the byte array is 0.

Wenting Liu  Dec 07, 2016 
PDF Page 287
Example 9-1 code

The last line inside the try in the while loop, calls:
connection.close();

What is redundant, as the connection was instantiated in a try-with-resources statement, that ensures that each resource is closed at the end of the statement (auto-closeable).

The author mention such resource in the title before the code, but still, wrongly explicit invoke the method close.

Anonymous  Aug 11, 2019