harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r546197 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/UUID.java main/java/java/util/Vector.java test/java/tests/api/java/util/VectorTest.java
Date Mon, 11 Jun 2007 16:58:31 GMT
Author: tellison
Date: Mon Jun 11 09:58:29 2007
New Revision: 546197

URL: http://svn.apache.org/viewvc?view=rev&rev=546197
Log:
Apply patch HARMONY-4120 ([classlib][luni] Remove some unnecessary synchronization blocks
for java.util.Vector & java.util.UUID)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UUID.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/VectorTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UUID.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UUID.java?view=diff&rev=546197&r1=546196&r2=546197
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UUID.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UUID.java Mon Jun
11 09:58:29 2007
@@ -132,9 +132,8 @@
             if (rng == null) {
                 rng = new SecureRandom();
             }
-            rng.nextBytes(data = new byte[16]);
         }
-
+        rng.nextBytes(data = new byte[16]);
         long msb = (data[0] & 0xFFL) << 56;
         msb |= (data[1] & 0xFFL) << 48;
         msb |= (data[2] & 0xFFL) << 40;

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java?view=diff&rev=546197&r1=546196&r2=546197
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java Mon Jun
11 09:58:29 2007
@@ -450,7 +450,7 @@
      * @see #size
      */
     @Override
-    public synchronized E get(int location) {
+    public E get(int location) {
         return elementAt(location);
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/VectorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/VectorTest.java?view=diff&rev=546197&r1=546196&r2=546197
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/VectorTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/VectorTest.java
Mon Jun 11 09:58:29 2007
@@ -496,8 +496,8 @@
 	 */
 	public void test_indexOfLjava_lang_ObjectI() {
 		// Test for method int java.util.Vector.indexOf(java.lang.Object, int)
-		assertTrue("Failed to find correct index", (tVector.indexOf("Test 98",
-				50) == 98));
+		assertEquals("Failed to find correct index", tVector.indexOf("Test 98",
+				50), 98);
 		assertTrue("Found index of bogus element", (tVector.indexOf(
 				"Test 1001", 50) == -1));
 		tVector.setElementAt(null, 20);
@@ -507,6 +507,22 @@
 				+ tVector.indexOf(null, 25), tVector.indexOf(null, 25) == 40);
 		assertTrue("b) Incorrect indexOf returned for null: "
 				+ tVector.indexOf(null, 20), tVector.indexOf(null, 20) == 20);
+		try {
+			tVector.indexOf("Test 98", -1);
+			fail("should throw ArrayIndexOutOfBoundsException");
+		} catch (ArrayIndexOutOfBoundsException e) {
+
+		}
+		assertEquals(-1, tVector.indexOf("Test 98", 1000));
+		assertEquals(-1, tVector.indexOf("Test 98", Integer.MAX_VALUE));
+		assertEquals(-1, tVector.indexOf("Test 98", tVector.size()));
+		assertEquals(98, tVector.indexOf("Test 98", 0));
+		try {
+			tVector.indexOf("Test 98", Integer.MIN_VALUE);
+			fail("should throw ArrayIndexOutOfBoundsException");
+		} catch (ArrayIndexOutOfBoundsException e) {
+
+		}
 	}
 
 	/**
@@ -615,6 +631,29 @@
 		assertTrue("Incorrect lastIndexOf returned for null: "
 				+ tVector.lastIndexOf(null, 45),
 				tVector.lastIndexOf(null, 45) == 40);
+
+		assertEquals(-1, tVector.lastIndexOf("Test 98", -1));
+		assertEquals(-1, tVector.lastIndexOf("Test 98", 0));
+		try {
+			assertEquals(-1, tVector.lastIndexOf("Test 98", 1000));
+			fail("should throw IndexOutOfBoundsException");
+		} catch (IndexOutOfBoundsException e) {
+		}
+		try {
+			assertEquals(-1, tVector.lastIndexOf("Test 98", Integer.MAX_VALUE));
+			fail("should throw IndexOutOfBoundsException");
+		} catch (IndexOutOfBoundsException e) {
+		}
+		try {
+			tVector.lastIndexOf("Test 98", tVector.size());
+			fail("should throw IndexOutOfBoundsException");
+		} catch (IndexOutOfBoundsException e) {
+		}
+		try {
+			tVector.indexOf("Test 98", Integer.MIN_VALUE);
+			fail("should throw ArrayIndexOutOfBoundsException");
+		} catch (ArrayIndexOutOfBoundsException e) {
+		}
 	}
 
 	/**



Mime
View raw message