[jdom-interest] Possible bug in beta 8

Doug Newton dnewton at tech-partners.com
Fri Aug 9 15:24:54 PDT 2002


I am in the middle of an upgrade from beta 7 to beta 8, and a junit test I have seems to have identified a bug in the current release (beta 8).  Currently you can create multiple Documents with the same Element at the root simulataneously.  No IllegalAddException is being thrown in the case that the Element is already a root element.  I did not see any documentation changes to imply that this was an intended change.

In beta 7, the Document.setRootElement(Element) method checks the Element passed into the method for any parent (through Element.getParent()) and for being a root element of another Document (through Element.isRootElement()).

In beta 8, the Document.setRootElement(Element) method does no checks on the Element passed into the method.  Instead, the check is now done later in the ContentList.add(int, Element) method.  BUT, it only checks for a parent (through getParent()).

I have not had a chance to test the very latest CVS snapshot, but I reviewed the relevant code and didn't see any changes from the beta 8 code that would fix this problem.

I have only done a quick check into this problem, so I may have missed something, or it may have already been fixed.  But the problem definitely exists in the beta 8 version available for download.

I have worked around this problem, as we wrap JDOM in our application, but I thought I make sure that if this bug has not been fixed that it gets identified ASAP.

Thanks.
Doug Newton
dnewton at tech-partners.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020809/c36543e2/attachment.htm


More information about the jdom-interest mailing list