[jdom-interest] How to "crash" JDOM, part 1

trebor.a.rude at lmco.com trebor.a.rude at lmco.com
Thu Aug 31 13:10:55 PDT 2000


	Forgot about the case of the tree being outside a document, not used
to working that way (DOM heritage, there). Given that, I agree that we have
to check that the added item is not the same object as the root, as you
suggested (in addition to checking self-reference and parent == null).
Anything else?

> -----Original Message-----
> From:	David W. Smiley [SMTP:dsmiley at mitre.org]
> Sent:	Thursday, August 31, 2000 1:01 PM
> To:	trebor.a.rude at lmco.com
> Cc:	jdom-interest at jdom.org
> Subject:	Re: [jdom-interest] How to "crash" JDOM, part 1
> 
> trebor.a.rude at lmco.com wrote:
> > 
> >         The existing implementation of addContent() already checks if
> > isRootElement is true, and won't allow the add if it is (unfortunately,
> adds
> > via the PartialList check neither condition and may well be used to
> create
> > all sorts of messed up trees, gotta make sure that gets fixed once we
> decide
> > the extent of the fix needed), so it shouldn't be possible to add the
> root
> > node as a child of any other Element in the tree. So again it looks like
> all
> > that is needed is a quick check for self-reference to prevent loops. Any
> > other cases?
> 
>   isRootElement will be false if you have a tree that is not part of a
> document.  This happens when you create an element, clone one, or remove
> one.
> 
> -- David Smiley
> 



More information about the jdom-interest mailing list