bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/43536] New: CopyOnWriteArrayList bug in delete() when emp


From: ecmarsden at gmail dot com
Subject: [Bug classpath/43536] New: CopyOnWriteArrayList bug in delete() when empty
Date: 26 Mar 2010 12:08:31 -0000

When deleting an element from an CopyOnWriteArrayList, a spurious exception is
raised. 

% jamvm Foo
Exception in thread "main" java.lang.NegativeArraySizeException
   at
java.util.concurrent.CopyOnWriteArrayList.remove(CopyOnWriteArrayList.java:455)
   at Foo.removeListener(Foo.java:18)
   at Foo.main(Foo.java:23)

The same code functions correctly with openjdk6. 

Below is code to reproduce the issue.

----------------------------------------------------------------------
import java.util.concurrent.CopyOnWriteArrayList;

public class Foo {
    private CopyOnWriteArrayList<Boolean> listeners;

    public Foo() {
        listeners = new CopyOnWriteArrayList<Boolean>();
    }

    public void removeListener(Boolean listener) {
        listeners.remove(listener);
    }

    public static void main(String[] arguments) {
        Foo myFoo = new Foo();
        myFoo.removeListener(new Boolean(true));
    }   
}


-- 
           Summary: CopyOnWriteArrayList bug in delete() when empty
           Product: classpath
           Version: 0.98
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ecmarsden at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43536





reply via email to

[Prev in Thread] Current Thread [Next in Thread]