[jdom-interest] XMLOutputter & null pointer exception.

Jason Hunter jhunter at collab.net
Thu Aug 17 21:11:44 PDT 2000

> Therefore, I want to throw my two cents into this discussion too.
> Like everybody else, I'd prefer getText to return "" for each of these
> cases,

Cool, I tend to be in agreement too.

My one issue (not real big) with this is that for the foo element:


The getMixedContent() List of content will include solely a "bar"
element, no empty string elements.  Somehow that doesn't feel right. 
But neither does returning null.  :-)

> setText(null)
> This is problematic for another reason besides requiring support for
> the xsl:null="true" attribute.  If you read the Javadoc for the Java 2
> List container class, you'll find out that it says List doesn't define
> the semantics of what happens if you add a null object to a List.
> Some List implementations accept it, some don't.

I don't see that as an issue.  We wouldn't be adding a null to any list
in response to that call.  We'd just be doing content.clear() on the
list, because setText() replaces all content.  (If you want to add a
string you say addContent("whatever").)


More information about the jdom-interest mailing list