TreeList.clear() generates a java.lang.IndexOutOfBoundsException: Cannot remove at -1 on list of size ...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

TreeList.clear() generates a java.lang.IndexOutOfBoundsException: Cannot remove at -1 on list of size ...

Vincent
This post has NOT been accepted by the mailing list yet.
I created a small program to reproduce this bug (see in attachment).
GlazedListTest.java
I create a new TreeList, then I add 2 elements to a TreeList. The result is OK
I call clear on the list and I get this exception.

java.lang.IndexOutOfBoundsException: Cannot remove at -1 on list of size 1
        at ca.odell.glazedlists.TransformedList.remove(TransformedList.java:113)
        at ca.odell.glazedlists.TransformedList.remove(TransformedList.java:114)
        at ca.odell.glazedlists.TreeList.remove(TreeList.java:294)
        at ca.odell.glazedlists.impl.SimpleIterator.remove(SimpleIterator.java:62)
        at ca.odell.glazedlists.AbstractEventList.clear(AbstractEventList.java:424)
        at ca.odell.glazedlists.TransformedList.clear(TransformedList.java:96)
        at org.eclipse.glazedlist.tests.GlazedListTest.main(GlazedListTest.java:43)

FYI, I'm working with Eclipse, GlazedList plugin version is 1.9.0.v201303080712.
Reply | Threaded
Open this post in threaded view
|

Re: TreeList.clear() generates a java.lang.IndexOutOfBoundsException: Cannot remove at -1 on list of size ...

Vincent
This post has NOT been accepted by the mailing list yet.
I found an other problem in the attached example: the add method returns true for the first add action and false for the second one...

Why ?
My problem with clear could come from this?

I posted the same topic on Eclipse : https://www.eclipse.org/forums/index.php/m/1422177/#msg_1422177