[jdom-interest] detach() [eg]

Kenworthy, Edward edward.kenworthy at exchange.co.uk
Mon Apr 30 00:17:09 PDT 2001

Hi Joseph

Uhm, no I see no need for a state-testing method as the argument is that if
you are trying to do something to a document in an invalid state then that
is an error in your code's logic and something that should throw an

Checking the document's state would only make sense if it were ok and
expected that the document would be in an invalid state without you knowing
about it without needing to check because you deliberately put it into an
invalid state.


-----Original Message-----
From: Joseph Bowbeer [mailto:jozart at csi.com]
Sent: 28 April 2001 19:37
To: jdom-interest at jdom.org
Subject: [jdom-interest] detach() [eg]

edward.kenworthy writes:

> Thirdly, Document isn't a bean so I fail to see why it should be
> constrained to behave like one.

I never said constrained; I was talking about degrees of comfort.  Behaving
as users expect makes our API more intuitive.  User's wouldn't expect that a
"getter" of what looks to be a simple property might throw an ISE.

State-Testing Method of Illegal State?

A more serious objection is the apparent absence of a state-testing method.
I haven't seen concrete code for the ISE Document idea (hint hint), but as
far as I can tell, the idea is that every accessor except setRootElement can
throw ISE and that we aren't providing any direct way for the user to test
if the Document is in an illegal state.

This sounds broken to me.  To fix this, we'd either need to let
getRootElement return null, or we'd need to add a separate state-testing
method.  Which one should it be?  Note that if getRootElement is allowed to
return null, then ISE has lost much of its fail-fast capability (right?).

Joe Bowbeer

To control your jdom-interest membership:

More information about the jdom-interest mailing list