Hi Dennis
 
Yes I think you're right, this is the right thing to do - though I always feel bad about 'breaking' peoples code.
 
I guess once developers get the new IllegalArgumentException its going to be pretty obvious which line of code is passing in the offending null string so its pretty easy to wrap an extra if () around the code as follows...
 
String s = ...;
if ( s != null ) {
    element.addText( s );
}
 
So yes I think we should do this.

James
----- Original Message -----
Sent: Thursday, October 25, 2001 6:35 PM
Subject: Re: [dom4j-dev] valueOf("text()") not getting full value?

Hi James,

It might be cleaner to make null an illegal value for the addText() call, and throw an IllegalArgumentException (or other exception) for it. Silently ignoring the call might create problems down the line ("I make three addText() calls, but there are only two text nodes in the result - what's going on?").

  - Dennis

James Strachan wrote:

 Element element = ...;element.addText ( null ); If this is the case then maybe we should explicitly check for null strings and quitely ignore them... 
James

Reply via email to