You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "spark shen (JIRA)" <ji...@apache.org> on 2007/07/31 03:35:52 UTC

[jira] Updated: (HARMONY-4576) [classlib][luni] AbstractList's remove method will throw unexpected ConcurrentModificationException

     [ https://issues.apache.org/jira/browse/HARMONY-4576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

spark shen updated HARMONY-4576:
--------------------------------

    Description: 
The following test case will fail on harmony, but pass on RI.

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();
                fail("Should throw IllegalStateException");
    	}
    	catch(IllegalStateException e){
    		//Excepted to catch IllegalStateException here
    	}
    }

  was:
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
    	}
    }


> [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
>
> The following test case will fail on harmony, but pass on RI.
> 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();
>                 fail("Should throw IllegalStateException");
>     	}
>     	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.