harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r495643 - in /harmony/enhanced/classlib/trunk/modules/math/src: main/java/java/math/BigInteger.java test/java/tests/api/java/math/BigIntegerTest.java
Date Fri, 12 Jan 2007 17:03:51 GMT
Author: tellison
Date: Fri Jan 12 09:03:49 2007
New Revision: 495643

URL: http://svn.apache.org/viewvc?view=rev&rev=495643
Log:
Apply patch HARMONY-1047 ([classlib][math]exception compatibility: new BigInteger(Integer.MAX_VALUE,
(Random)null))

Modified:
    harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigInteger.java
    harmony/enhanced/classlib/trunk/modules/math/src/test/java/tests/api/java/math/BigIntegerTest.java

Modified: harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigInteger.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigInteger.java?view=diff&rev=495643&r1=495642&r2=495643
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigInteger.java (original)
+++ harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigInteger.java Fri
Jan 12 09:03:49 2007
@@ -94,9 +94,6 @@
             // math.1B=numBits must be non-negative
             throw new IllegalArgumentException(Messages.getString("math.1B")); //$NON-NLS-1$
         }
-        if (rnd == null) {
-            throw new NullPointerException();
-        }
         if (numBits == 0) {
             sign = 0;
             numberLength = 1;

Modified: harmony/enhanced/classlib/trunk/modules/math/src/test/java/tests/api/java/math/BigIntegerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/math/src/test/java/tests/api/java/math/BigIntegerTest.java?view=diff&rev=495643&r1=495642&r2=495643
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/math/src/test/java/tests/api/java/math/BigIntegerTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/math/src/test/java/tests/api/java/math/BigIntegerTest.java
Fri Jan 12 09:03:49 2007
@@ -81,6 +81,14 @@
 	 * @tests java.math.BigInteger#BigInteger(int, java.util.Random)
 	 */
 	public void test_ConstructorILjava_util_Random() {
+        // regression test for HARMONY-1047
+		try {
+			new BigInteger(Integer.MAX_VALUE, (Random)null);
+			fail("NegativeArraySizeException expected");
+		} catch (NegativeArraySizeException e) {
+            // PASSED
+		}
+		
 		bi = new BigInteger(70, rand);
 		bi2 = new BigInteger(70, rand);
 		assertTrue("Random number is negative", bi.compareTo(zero) >= 0);



Mime
View raw message