[jdom-interest] Element.getText() bug

Jason Peck jpeck at stshotelnet.com
Wed Sep 20 13:15:05 PDT 2000

I think I have found a bug in the 9/17/00 build of JDOM.

When calling the getText() method of an element that has no data (ie.
<user></user> ), the Element.getText() method throws a NullPointer
exception.  However, if for some funny reason, I output the xml to screen
using XMLOutputter first, the exception is not thrown.  I saw in a previous
post that a change was made to XMLOutputter.output to change <user></user>
to <user/> if no data is found between.  Shouldn't getText() either return
NULL or "" if no text is found??


More information about the jdom-interest mailing list