harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r412625 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/ArrayList.java test/java/org/apache/harmony/tests/java/util/ArrayListTest.java
Date Thu, 08 Jun 2006 00:38:56 GMT
Author: ndbeyer
Date: Wed Jun  7 17:38:56 2006
New Revision: 412625

URL: http://svn.apache.org/viewvc?rev=412625&view=rev
Log:
Fix for HARMONY-539 ArrayList.addAll(0, ...) index out of bounds exception

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/ArrayListTest.java
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java?rev=412625&r1=412624&r2=412625&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
Wed Jun  7 17:38:56 2006
@@ -175,8 +175,7 @@
                 lastIndex += growSize;
             }
         } else if (location == 0) {
-            if (firstIndex == 0)
-                growAtFront(growSize);
+            growAtFront(growSize);
             firstIndex -= growSize;
         } else if (location == size) {
             if (lastIndex > array.length - growSize)

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/ArrayListTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/ArrayListTest.java?rev=412625&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/ArrayListTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/ArrayListTest.java
Wed Jun  7 17:38:56 2006
@@ -0,0 +1,25 @@
+package org.apache.harmony.tests.java.util;
+
+import java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+public class ArrayListTest extends TestCase {
+
+    public void test_addAllCollectionOfQextendsE() {
+        // Regression for HARMONY-539
+        // https://issues.apache.org/jira/browse/HARMONY-539
+        ArrayList<String> alist = new ArrayList<String>();
+        ArrayList<String> blist = new ArrayList<String>();
+        alist.add("a");
+        alist.add("b");
+        blist.add("c");
+        blist.add("d");
+        blist.remove(0);
+        blist.addAll(0, alist);
+        assertEquals("a", blist.get(0));
+        assertEquals("b", blist.get(1));
+        assertEquals("d", blist.get(2));
+    }
+
+}
\ No newline at end of file

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/ArrayListTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message