The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by sorteper]

Hi,

As I didn't find any other place to post errata I thought I might do it here.
Well I've not quite finished with the book, actually only just begun.

Chapter 2: Source code NullpointerException prone code:
e.g listing 2.2 page 40:
if (this.domain == null ^ domain == null) :: this will be false if either
both are null or none are null. Problem is when both are null .. You should
use OR (||) not XOR (^)


Chapter 2: <presence> default:
page 54 first paragraph states that "The <presence> packet default type is
'unavailable'" .. that is not quite true:
type - Describes the type of presence. No 'type' attribute, or inclusion of a
type not specified here, implies that the sender is available.
(as stated in
http://www.jabber.org/ietf/draft-miller-jabber-00.html#common-presence)
import-bot (20211) [Avatar] Offline
#2
Re: errata !?
[Originally posted by iainshigeoka]

> As I didn't find any other place to post errata I thought I might do it here.
> Well I've not quite finished with the book, actually only just begun.

This seems like the best place for it. smilie

> Chapter 2: Source code NullpointerException prone code:
> e.g listing 2.2 page 40:
> if (this.domain == null ^ domain == null) :: this will be false if either
> both are null or none are null. Problem is when both are null .. You should
> use OR (||) not XOR (^)

Thanks. You're right. I tried to take a shortcut to save page space and
muffed it. It should rightfully be:

if (this.domain == null && domain == null){
return true;
}
if (this.domain == null || domain == null){
return false;
}
return this.domain.equalsIgnoreCase(domain);

Even better for production code would be to not allow null values for the
domain field (or any other field) of the JabberID class. There is also an
ambiguity between the value "" (an empty string) and a null value for the
domain or the other fields. Should they be equivalent? In most cases, a null
is used to indicate no value being set, which implies the default value. In
most cases, an empty string should be the same...

The JabberID class presented in the book is also lacking code to enforce
proper Jabber ID formats. For example, illegal characters such as '@', '/',
etc. can be added to parts of the Jabber ID using the setter methods and the
toString() method will generate invalid Jabber IDs.

I'll definitely add this to the errata. Thanks. I do wish to warn you though
that the class is far from robust and probably requires 5x the amount of code
present to be production worthy. smilie

> Chapter 2: <presence> default:
> page 54 first paragraph states that "The <presence> packet default type is
> 'unavailable'" .. that is not quite true:
> type - Describes the type of presence. No 'type' attribute, or inclusion of a
> type not specified here, implies that the sender is available.
> (as stated in
> http://www.jabber.org/ietf/draft-miller-jabber-00.html#common-presence)

Yes, the second and third occurances of "unavailable" in that paragraph should
be "available". It sure is confusing the way it is now. ;(

Thanks for your feedback.

-iain
import-bot (20211) [Avatar] Offline
#3
Re: errata !? -- deja vu
[Originally posted by sorteper]

You're welcome :o)

I enjoy reading your book and look forward to finish it, that I may have a
sound base in Jabber Programming. And thus actually implement some kind of
solution.

I've been reading a bit further and discovered that a few times paragraphs are
duplicated - which is a bit confusing. I'm sorry to say that I've lost the
first (perhaps more) duplicate(s), though it must be within the first 4
chapters. The second is on top of page 111.

/lauge