[jdom-interest] NoSuch*Exceptions in JDOM
Patrick Dowler
Patrick.Dowler at nrc.ca
Tue Jun 27 10:04:36 PDT 2000
On Fri, 23 Jun 2000, you wrote:
> I suggest a new method following the java.util.Properties pattern
> meets the underlying need and solves your problem. Namely:
>
> public Element getChild(String aString, Object defaultValue)
>
> It does not throw a NoSuchElementException and can return
> a null, "" or 0 as appropriate. -GreatOne--
This seems to go totally against what most people are trying to do. If
you call getChild, you really want to know if the child was there or not.
Having a default value returned doesn't seem too useful for anyone...
correct me if I'm wrong on that :-)
For something simple like Properties, it makes sense. For a child
element, you could be talking about a whole structure ( the "body"
child of an "html" Element, for example).
Did this ever get resolved? What is the current standing of returning
null vs. throwing NoSuchElementException from getChild? I got the
feeling last week that we have not reached any consensus on this...
I'm still for a null return value.
--
Patrick Dowler
Canadian Astronomy Data Centre
More information about the jdom-interest
mailing list