harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r482597 - in /harmony/enhanced/classlib/trunk/modules/security/src: main/java/common/java/security/Signer.java test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java
Date Tue, 05 Dec 2006 11:15:44 GMT
Author: smishura
Date: Tue Dec  5 03:15:38 2006
New Revision: 482597

URL: http://svn.apache.org/viewvc?view=rev&rev=482597
Log:
Fix and regression test for HARMONY-2408 ([classlib][security] java.security.Signer.setKeyPair(null)
throws InvalidParameterException while RI throws NPE)

Modified:
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signer.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signer.java?view=diff&rev=482597&r1=482596&r2=482597
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signer.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signer.java
Tue Dec  5 03:15:38 2006
@@ -81,8 +81,12 @@
      */
     public final void setKeyPair(KeyPair pair)
             throws InvalidParameterException, KeyException {
-        if ((pair == null) || (pair.getPrivate() == null)
-                || (pair.getPublic() == null)) {
+        
+        if (pair == null) {
+            throw new NullPointerException();
+        }
+
+        if ((pair.getPrivate() == null) || (pair.getPublic() == null)) {
             throw new InvalidParameterException();
         }
         SecurityManager sm = System.getSecurityManager();

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java?view=diff&rev=482597&r1=482596&r2=482597
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java
Tue Dec  5 03:15:38 2006
@@ -147,6 +147,14 @@
      */
     public void test_setKeyPairLjava_security_KeyPair() throws Exception {
         
+        // Regression for HARMONY-2408
+        // test: NullPointerException if pair is null
+        try {
+            new SignerStub("name").setKeyPair(null);
+            fail("No expected NullPointerException");
+        } catch (NullPointerException e) {
+        }
+        
         // test: SecurityException if permission is denied
         SecurityManager oldSm = System.getSecurityManager();
         MySecurityManager sm = new MySecurityManager();



Mime
View raw message