harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r420344 - in /incubator/harmony/enhanced/classlib/trunk/modules/math/src: main/java/java/math/BigDecimal.java test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java
Date Sun, 09 Jul 2006 20:16:06 GMT
Author: tellison
Date: Sun Jul  9 13:16:06 2006
New Revision: 420344

URL: http://svn.apache.org/viewvc?rev=420344&view=rev
Log:
Apply patch HARMONY-784 ([classlib][math] compatibility: no NPE for java.math.BigDecimal((BigInteger)
null))

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigDecimal.java
    incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigDecimal.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigDecimal.java?rev=420344&r1=420343&r2=420344&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigDecimal.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigDecimal.java
Sun Jul  9 13:16:06 2006
@@ -210,7 +210,10 @@
      * as 0.
      */
     public BigDecimal(BigInteger value) {
-        intVal = value;
+        if (value == null) {
+        	throw new NullPointerException();
+        }
+    	intVal = value;
         scale = 0;
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java?rev=420344&r1=420343&r2=420344&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java
Sun Jul  9 13:16:06 2006
@@ -71,6 +71,12 @@
         BigDecimal aNumber = new BigDecimal(bA);
         assertEquals("incorrect value", bA, aNumber.unscaledValue());
         assertEquals("incorrect scale", 0, aNumber.scale());
+        try {
+        	new BigDecimal((BigInteger) null);
+        	fail("No NullPointerException");
+        } catch (NullPointerException e) {
+        	//expected
+        }
     }
      
     /**



Mime
View raw message