[jdom-interest] Problem with the clone method in Document (latest version)

Jason Hunter jhunter at collab.net
Wed Aug 23 19:07:35 PDT 2000

Richard McAneny wrote:
> I have found a problem with the clone method in Document with the tip
> version (and prior) of JDOM: In the clone method the root element is 
> being added twice.

Good bug find.  I fixed it in CVS.  

> Here is my sample code to see this happen.
>         Element docRoot = new Element("test");
>         Element child = new Element("child1");
>         child.setText("hello");
>         docRoot.addContent(child);
>         Document document = new Document(docRoot);
>         Document document2 = (Document) document.clone();
> throws the following exception:

Just ran the code and no exception.  :-)


More information about the jdom-interest mailing list