[jdom-interest] NoSuch*Exceptions in JDOM
brett.mclaughlin at lutris.com
Tue Jun 27 10:55:39 PDT 2000
Patrick Dowler wrote:
> 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...
We're still sort of letting this run its course. I'm still /not/ for
null, but we're going to let this go on a bit. So far, I've seen
remarkably little in the way of resolution (people are still voicing
their opinions, which is good), so we're just ... waiting... ;-)
> I'm still for a null return value.
> Patrick Dowler
> Canadian Astronomy Data Centre
> To control your jdom-interest membership:
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc.
1200 Pacific Avenue, Suite 300
Santa Cruz, CA 95060 USA
More information about the jdom-interest