[jdom-interest] detach() [eg]

Kenworthy, Edward edward.kenworthy at exchange.co.uk
Sun Apr 22 23:50:43 PDT 2001

That's why I proposed the document throw an IllegalStateException, it's a
RuntimeException so it doesn't have to be caught (ie the compiler doesn't
force you to have a try-catch, so none of the extra code people were
bemoaning) and as having the document in an illegal state is almost
certainly a programmer error this seems quite ok to me. And of course if you
want to catch it, then you can.

-----Original Message-----
From: Scott Means [mailto:smeans at moonlightideas.com]
Sent: 23 April 2001 03:49
To: jdom-interest at jdom.org
Subject: Re: [jdom-interest] detach() [eg]

It seems to me that one of Jason's major objections is the need to catch a
random new exception anytime he wants to use the .detach() method, e.g.:

> >} catch (IllegalXXXException e) {

The true meaning of this exception is: "You've tried to violate XML
well-formedness." So maybe it would be a good time to think about a
general-purpose WellFormednessException that could be thrown for anything
that would break the document. Unfortunately, it looks like there are
already a number of Illegal???Exceptions that would fall under this
umbrella, so I guess it's too late. But it seems like it would be
convenient (and not too icky for the programmer) to just catch a single
WellFormednessException for any of these violations and sort through the
exception message. And on that tack, when it comes time to worry about
in-memory validity, you could have a ValidityException to go with it.

Scott Means (smeans at moonlightideas.com)

To control your jdom-interest membership:

More information about the jdom-interest mailing list