[jdom-interest] Text class (Modified)

philip.nelson at omniresources.com philip.nelson at omniresources.com
Mon May 28 07:00:26 PDT 2001

> >public class Text {
> >     public Text(String stringValue) {
> >         value = new StringBuffer(stringValue);
> >     }
> What should we do if stringValue is null? I suggest throwing an 
> immediate NullPointerException.

Yes, it is consistent with what we decided with most of the other setters.
(someday I need to update the tests so they are happy with the decision)

> What should we do if stringValue is empty? Does it make sense to 
> allow an empty text node?

I have no problem with this, it's a quick way to remove the text content.  I
do think the idea to setLength(0) and then use the existing StringBuffer
makes more sense though.

More information about the jdom-interest mailing list