harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r421537 - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src: main/java/common/java/security/spec/EllipticCurve.java test/api/java/org/apache/harmony/security/tests/java/security/spec/EllipticCurveTest.java
Date Thu, 13 Jul 2006 08:15:28 GMT
Author: mloenko
Date: Thu Jul 13 01:15:27 2006
New Revision: 421537

URL: http://svn.apache.org/viewvc?rev=421537&view=rev
Log:
fixes for HARMONY-732
[classlib][security] unexpected NPE for java.security.spec.EllipticCurve.getSeed() if seed
= null

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/spec/EllipticCurve.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/EllipticCurveTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/spec/EllipticCurve.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/spec/EllipticCurve.java?rev=421537&r1=421536&r2=421537&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/spec/EllipticCurve.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/spec/EllipticCurve.java
Thu Jul 13 01:15:27 2006
@@ -121,10 +121,14 @@
      * @com.intel.drl.spec_ref
      */
     public byte[] getSeed() {
-        // return copy
-        byte[] ret = new byte[seed.length];
-        System.arraycopy(seed, 0, ret, 0, ret.length);
-        return ret;
+        if (seed == null) {
+            return null;
+        } else {
+            // return copy
+            byte[] ret = new byte[seed.length];
+            System.arraycopy(seed, 0, ret, 0, ret.length);
+            return ret;
+        }
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/EllipticCurveTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/EllipticCurveTest.java?rev=421537&r1=421536&r2=421537&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/EllipticCurveTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/EllipticCurveTest.java
Thu Jul 13 01:15:27 2006
@@ -14,11 +14,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Vladimir N. Molotkov
-* @version $Revision$
-*/
-
 package org.apache.harmony.security.tests.java.security.spec;
 
 import java.math.BigInteger;
@@ -37,18 +32,6 @@
 public class EllipticCurveTest extends TestCase {
 
     /**
-     * Constructor for EllipticCurveTest.
-     * @param name
-     */
-    public EllipticCurveTest(String name) {
-        super(name);
-    }
-
-    //
-    // Tests
-    //
-
-    /**
      * Test #1 for <code>EllipticCurve(ECField, BigInteger, BigInteger, byte[])</code>
      * constructor<br>
      * Assertion: creates instance of EllipticCurve<br>
@@ -574,6 +557,17 @@
         EllipticCurve c = new EllipticCurve(f, a, b, seed);
         c.getSeed();
         assertNotSame(c.getSeed(), c.getSeed());
+    }
+
+    /**
+     * @tests java.security.spec.EllipticCurve#getSeed()
+     * Assertion: null if not specified
+     */    
+    public final void testGetSeed04() {
+        //Regression for HARMONY-732
+        ECFieldFp f = new ECFieldFp(BigInteger.valueOf(23L));
+        BigInteger a = BigInteger.ONE;
+        assertNull(new EllipticCurve(f, a, a).getSeed());
     }
 
     /**



Mime
View raw message