[jdom-interest] Next JDOM evolution

phil at triloggroup.com phil at triloggroup.com
Sat Mar 30 23:49:44 PST 2002

I  personnaly faced 3 problems when moving from B7 to B8

=> First is the introduction of the text class. As we often do a getContent() and check the type of a node, this code
was broken. Moreover, it is quite dificult to locate compared to a method removal or a signature change.

=> Secundo, getRootElement() now throws an exception instead of retuning null. Currently, we have lots of code like
    if( doc.getRootElement()!=null ) {
And this code is also broken, and also *very* difficult to locate. For example, if you have a method like
    void doSomething( Element e ) {
        if( e!=null ) {
You should be careful when you call it.
Moreover, I thought that this change was unhappy for the following 2 reasons:
* Document allows a null root, so it is not an illegal state but a valid one
* this is not coherent with other methods (ex: Element.getChild(String name)). So, when to check the returned value and
when to catch an exception? As it is not an error, it should not throw an exception.
To be honest, that change has so many impacts that it justified I built my own JDOM jar file and keep the old behavior!!

=> Finally, the list changes also broke some code, by throwing some ConcurrentModificationException or changing some
behaviors (ex: getting a children list and, while browsing it, removing some elements).
But I admit that, even if there some incompatibilities, we previously incorrectly used the list and this is safer now.

>>>As I've said several times over the last year, I look forward to when JDOM does have a stable release<<<
I completly agree with Denis. We are now using JDOM for while (about 1 year & half), because we trusted the product
philosophy and found it as a great and easier alternative to the classical DOM. But since that time, it is still beta,
evolving while not maintaining compatiblity, and we cannot rely on it. As Denis said, JDOM is often presented as a 'de
facto' standard (which, for example, DOM4J is not while stable!) and it should assume this state. Brett already wrote
chapters in his books, Elliot is also going to write some... It is really now time to release it, this is the only way
to a wide acceptance and recongition.


More information about the jdom-interest mailing list