[jdom-interest] NoSuch*Exceptions in JDOM
Thomas M. Sasala
tsasala at hifusion.com
Mon Jun 19 15:53:09 PDT 2000
I personally like returning null. Catching exceptions has become
a very serious PITA for us while processing attributes. It's
complicated,
but we're merging elements - some have the attributes and some don't.
It's
a lot easier to test for null, add the attribute, and move than catch
an exception. Plus, isn't there a significant amount of overhead
for a try/catch (just a rumor I remember reading about a number of
years ago)?
-Tom
Dehar Rohit wrote:
>
> support:
>
> Returning a null is more java-like and thats what JDOM is intended to
> be. The thingy coming nearest to getChild() is java.util.Hashtable's
> get() method (it returns the value to which the specified key is
> mapped in this hashtable). It doesn't throw a No*Exception, plainly
> returns a null if the key is not found.
>
> plus:
>
> its easier to check nulls than an exception every time. i'd
> personally prefer null returns for xpath type support too (is that
> too early to talk of xpath?).
>
> Rohit Dehar
>
More information about the jdom-interest
mailing list