From a5090a34f55b9c13775844b9b70e8bc41e2aab03 Mon Sep 17 00:00:00 2001 From: aph Date: Tue, 27 Apr 2010 17:28:08 +0000 Subject: 2010-04-27 Andrew Haley * java/util/concurrent/CopyOnWriteArrayList.java: Fix for empty list. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158790 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/classpath/ChangeLog | 5 +++++ .../java/util/concurrent/CopyOnWriteArrayList.java | 7 ++++++- .../util/concurrent/CopyOnWriteArrayList$1.class | Bin 2314 -> 2314 bytes .../util/concurrent/CopyOnWriteArrayList$2.class | Bin 1350 -> 1350 bytes .../util/concurrent/CopyOnWriteArrayList$3.class | Bin 2115 -> 2115 bytes .../CopyOnWriteArrayList$RandomAccessSubList.class | Bin 1081 -> 1081 bytes .../concurrent/CopyOnWriteArrayList$SubList.class | Bin 4878 -> 4878 bytes .../java/util/concurrent/CopyOnWriteArrayList.class | Bin 11229 -> 11264 bytes 8 files changed, 11 insertions(+), 1 deletion(-) (limited to 'libjava/classpath') diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog index f98d1c95b1e..1db1158ff9a 100644 --- a/libjava/classpath/ChangeLog +++ b/libjava/classpath/ChangeLog @@ -1,3 +1,8 @@ +2010-04-27 Andrew Haley + + * java/util/concurrent/CopyOnWriteArrayList.java: Fix for empty + list. + 2010-04-27 Andrew Haley * gnu/javax/print/ipp/IppResponse.java (parseAttributes): Handle diff --git a/libjava/classpath/java/util/concurrent/CopyOnWriteArrayList.java b/libjava/classpath/java/util/concurrent/CopyOnWriteArrayList.java index 6e4fb9a8ac9..02071829269 100644 --- a/libjava/classpath/java/util/concurrent/CopyOnWriteArrayList.java +++ b/libjava/classpath/java/util/concurrent/CopyOnWriteArrayList.java @@ -452,7 +452,12 @@ public class CopyOnWriteArrayList public synchronized boolean remove(Object element) { E[] snapshot = this.data; - E[] newData = (E[]) new Object[snapshot.length - 1]; + int len = snapshot.length; + + if (len == 0) + return false; + + E[] newData = (E[]) new Object[len - 1]; // search the element to remove while filling the backup array // this way we can run this method in O(n) diff --git a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$1.class b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$1.class index 2dba6818fd6..a8f5b0acb70 100644 Binary files a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$1.class and b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$1.class differ diff --git a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$2.class b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$2.class index 03ab92a5ec1..2ac97190710 100644 Binary files a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$2.class and b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$2.class differ diff --git a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$3.class b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$3.class index 1f2e00af9ba..c20c1fecf97 100644 Binary files a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$3.class and b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$3.class differ diff --git a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$RandomAccessSubList.class b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$RandomAccessSubList.class index 83fd284ec57..df5d0783cd3 100644 Binary files a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$RandomAccessSubList.class and b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$RandomAccessSubList.class differ diff --git a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$SubList.class b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$SubList.class index 572a880ad34..12650197072 100644 Binary files a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$SubList.class and b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList$SubList.class differ diff --git a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList.class b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList.class index 0e7bd0f5aee..97d63d83b3f 100644 Binary files a/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList.class and b/libjava/classpath/lib/java/util/concurrent/CopyOnWriteArrayList.class differ -- cgit v1.2.1