[jdom-interest] NoSuch*Exceptions in JDOM

bob bob at werken.com
Fri Jun 16 10:20:12 PDT 2000


> if NoSuchElementException is designed, simply to eliminate the need to
> check for a null, then I would suggest that using a List is just as heavy
> weight.

	It typically for people doing long paths.

	elem.getChild("foo").getChild("bar").getChild("baz);

	You can wrap that with a single try/catch for the
	entire chain.  Otherwise, you have to wrap each
	getChild() call with an "if (elem != null)".  Which
	turns into a lot of typing.

	Also, Exception handling in Java isn't heavy-weight.
	It's computationally similar to a normal return, with
	an 'isAnException' flag set.  Remember that Java isn't
	compiled C++ code.

		-bob




More information about the jdom-interest mailing list