harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r370506 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni: ./ src/main/java/java/util/ src/test/java/org/apache/harmony/tests/java/util/
Date Thu, 19 Jan 2006 15:50:36 GMT
Author: tellison
Date: Thu Jan 19 07:50:29 2006
New Revision: 370506

URL: http://svn.apache.org/viewcvs?rev=370506&view=rev
Log:
Fix and regression test for HARMONY-19 (Divide by zero exception when rotating an empty List)

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/CollectionsTest.java
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/.project
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/AllTests.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/.project
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/.project?rev=370506&r1=370505&r2=370506&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/.project (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/.project Thu Jan 19 07:50:29 2006
@@ -25,11 +25,4 @@
 		<nature>org.eclipse.pde.PluginNature</nature>
 		<nature>org.eclipse.jdt.core.javanature</nature>
 	</natures>
-	<linkedResources>
-		<link>
-			<name>src.kernel</name>
-			<type>2</type>
-			<locationURI>HY_WORKSPACE/kernel/src/main/java</locationURI>
-		</link>
-	</linkedResources>
 </projectDescription>

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java?rev=370506&r1=370505&r2=370506&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
Thu Jan 19 07:50:29 2006
@@ -1777,6 +1777,11 @@
 	public static void rotate(List list, int dist) {
 		int size = list.size();
 
+		// Can't sensibly rotate an empty collection
+		if (size == 0) {
+			return;
+		}
+
 		// normalize the distance
 		if (dist > 0)
 			dist = dist % size;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/AllTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/AllTests.java?rev=370506&r1=370505&r2=370506&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/AllTests.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/AllTests.java
Thu Jan 19 07:50:29 2006
@@ -29,6 +29,7 @@
 				"Test for org.apache.harmony.tests.java.util");
 		//$JUnit-BEGIN$
 		suite.addTestSuite(ArraysTest.class);
+		suite.addTestSuite(CollectionsTest.class);
 		//$JUnit-END$
 		return suite;
 	}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/CollectionsTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/CollectionsTest.java?rev=370506&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/CollectionsTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/CollectionsTest.java
Thu Jan 19 07:50:29 2006
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.harmony.tests.java.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+import junit.framework.TestCase;
+
+public class CollectionsTest extends TestCase {
+
+	/**
+	 * @tests java.util.Collections#rotate(java.util.List, int)
+	 */
+	public void test_rotateLjava_util_ListI() {
+		// Regression for HARMONY-19 Rotate an *empty* list
+		Collections.rotate(new ArrayList(), 25);
+	}
+}



Mime
View raw message