spec@saaj.java.net

Re: Need clarification on SOAPElement.addTextNode

From: Kumar Jayanti <v.b.kumar.jayanti_at_oracle.com>
Date: Tue, 27 Mar 2012 14:10:20 +0530

Hi Jim,

On 26-Mar-2012, at 7:57 PM, Jim Knutson wrote:

>
> 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.
I would like to throw IllegalArgumentException as this would be in line with other Java API's. Will make an update and release it into the maven repository soon.

Thanks,
kumar

> 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
>