OK I've implemented the patch such that attempts to add a Text node to an Element with a null String will throw an IllegalArgumentException. Its available in the daily build right now if anyone wants to try it out.
The change has been made in the DocumentFactory.createText() method. If this change has a big impact on anyone you could always provide your own DocumentFactory, or Element derivation to either quietly ignore null strings or swap them with empty strings as a temporary work around. James ----- Original Message ----- From: James Strachan To: Dennis Sosnoski Cc: Doug Hoppes ; [EMAIL PROTECTED] Sent: Friday, October 26, 2001 10:53 AM Subject: Re: [dom4j-dev] valueOf("text()") not getting full value? 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 ----- From: Dennis Sosnoski To: James Strachan Cc: Doug Hoppes ; [EMAIL PROTECTED] 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 _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev