[jdom-interest] getText() returns null or ""

Laurent Bihanic lbihanic at atos-group.com
Wed Oct 4 07:49:37 PDT 2000


Ryan Leavengood wrote:
> 
> [...] My thoughts are that nulls should only be returned to
> indicate an error condition or flag something.
> 

I strongly disagree with that: Error conditions are signalled by throwing
exceptions.  Null can be a valid return value but, as it is a special value,
the possibility for a method to return null shall be well documented.

Whatever the chosen solution, the documentation should clearly state whether
or not a null value can be returned (a typical bad example being
java.lang.String.trim()).

Laurent



More information about the jdom-interest mailing list