spec@saaj.java.net

Need clarification on SOAPElement.addTextNode

From: Jim Knutson <knutson_at_us.ibm.com>
Date: Mon, 26 Mar 2012 09:27:22 -0500

We have seen a number of customer problems raised where customers have
passed a null argument to SOAPElement.addTextNode(). Our implementation
and the RI both throw a NullPointerException and when this happens
customers think that there's a problem with the runtime rather than with
their code patterns. We could change the exception we throw, but it would
likely cause some confusion as vendor implementations start to diverge in
behavior. We'd like a clarification added to the addTextNode method
description saying that null must not passed in and that doing so will
result in a SOAPException being thrown. Hopefully, this will ensure
aligned behaviors across all the vendors and clear up the confusion
regarding passing null.

One other possibility would be to throw an IllegalArgumentException when
null is passed in. Either would suffice as long as the spec is clear about
the behavior and the exception message indicates that the reason is the
null argument.

Thanks,
Jim Knutson
WebSphere Java EE Architect