harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Qiu (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-5808) [classlib][luni] add() method of listIterator implementation in AbstractList may throw unexpected ConcurrentModificationException
Date Tue, 06 May 2008 02:51:55 GMT
[classlib][luni] add() method of listIterator implementation in AbstractList may throw unexpected
ConcurrentModificationException
---------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-5808
                 URL: https://issues.apache.org/jira/browse/HARMONY-5808
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 5.0M6
            Reporter: Sean Qiu
             Fix For: 5.0M6


add() method of listIterator implementation in AbstractList may throw unexpected ConcurrentModificationException.
Its behavior is different from the one of RI.

Here is the test case:

public class AbstractListTest extends junit.framework.TestCase {

    public void test_listIterator() {
        list = new MockArrayList();
        ListIterator it = list.listIterator();
        it.add("one");
        it.add("two");
        assertEquals(2,list.size());
    }

    class MockArrayList<E> extends AbstractList<E> {

    	ArrayList<E> list = new ArrayList<E>();
    	
    	public E remove(int idx) {
    		modCount++;
    		return list.remove(idx);
    	}

    	@Override
    	public E get(int index) {
    		return list.get(index);
    	}

    	@Override
    	public int size() {
    		return list.size();
    	}

    	@Override    	
    	public void add(int idx, E o) {
    		modCount += 10;
    		list.add(idx, o);
    	}
    }

}

Test results:
RI  can pass this test.
Harmony will throw a ConcurrentModificationException.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message