Bugs item #1484052, was opened at 2006-05-08 12:24
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1484052&group_id=16035

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Add element sometimes causes confusing exception

Initial Comment:
When using Element.elements.add(int, Object) to add an 
Element, I get this exception:
java.lang.IndexOutOfBoundsException: Index: -1, Size: 
12  at java.util.ArrayList.add(ArrayList.java:367)  at 
org.dom4j.tree.AbstractElement.addNewNode
(AbstractElement.java:1552)  at 
org.dom4j.tree.AbstractElement.addNode
(AbstractElement.java:1536)  at 
org.dom4j.tree.BackedList.add(BackedList.java:79)

if I use code similar to this:
parentElements.add(newPosition, newNode.detach());

I am trying to move a child element within the same 
parent. The detach() causes the BackedList to not find 
elements properly any longer and to cause this 
exception when the add occurs in BackedList on line 79:
branch.addNode(realIndex, asNode(object));
(realIndex will always be -1).

This behavior should actually work, but does not. In 
addition, you get this confusing error message since 
the index is not -1 and the size is not 12 (the branch 
list is larger than just the element list).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1484052&group_id=16035


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
dom4j-dev mailing list
dom4j-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to