harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "spark shen (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4576) [classlib][luni] AbstractList's remove method will throw unexpected ConcurrentModificationException
Date Tue, 31 Jul 2007 01:22:53 GMT
[classlib][luni] AbstractList's remove method will throw unexpected ConcurrentModificationException
---------------------------------------------------------------------------------------------------

                 Key: HARMONY-4576
                 URL: https://issues.apache.org/jira/browse/HARMONY-4576
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: spark shen


class MockRemoveFailureArrayList<E> extends AbstractList<E> {

		@Override
		public E get(int location) {
			// TODO Auto-generated method stub
			return null;
		}

		@Override
		public int size() {
			// TODO Auto-generated method stub
			return 0;
		}
		
		public E remove(int idx) {
    		modCount+=2;
    		return null;
    	}
		
		public int getModCount(){
			return modCount;
		}
    }
    
    //test remove for failure by inconsistency of modCount and expectedModCount 
    public void test_remove(){
    	MockRemoveFailureArrayList<String> mrfal = new MockRemoveFailureArrayList<String>();
    	Iterator<String> imrfal= mrfal.iterator();
    	imrfal.next();
    	imrfal.remove();
    	try{
    		imrfal.remove();
    	}
    	catch(ConcurrentModificationException e){
    		fail("Excepted to catch IllegalStateException not ConcurrentModificationException");
    	}
    	catch(IllegalStateException e){
    		//Excepted to catch IllegalStateException here
    	}
    }

-- 
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