harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r388424 - /incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/java/security/cert/X509CertSelectorTest.java
Date Fri, 24 Mar 2006 07:14:22 GMT
Author: tellison
Date: Thu Mar 23 23:14:21 2006
New Revision: 388424

URL: http://svn.apache.org/viewcvs?rev=388424&view=rev
Log:
Regression test for HARMONY-186 (X509CertSelector.match throws ArrayIndexOutOfBoundsException
when checks keyUsage criterion)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/java/security/cert/X509CertSelectorTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/java/security/cert/X509CertSelectorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/java/security/cert/X509CertSelectorTest.java?rev=388424&r1=388423&r2=388424&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/java/security/cert/X509CertSelectorTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/test/common/unit/java/security/cert/X509CertSelectorTest.java
Thu Mar 23 23:14:21 2006
@@ -22,8 +22,6 @@
 package java.security.cert;
 
 import java.io.IOException;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.math.BigInteger;
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
@@ -2938,6 +2936,25 @@
                                     selector.match((X509Certificate) null));
         assertTrue("The certificate should mathc the selector", 
                                     selector.match(cert));
+    }
+
+    /**
+     * @tests java.security.cert.X509CertSelector#match(java.security.cert.Certificate)
+     */
+    public void test_matchLjava_security_cert_Certificate() {
+
+        // Regression for HARMONY-186
+        TestCert cert = new TestCert();
+        cert.setKeyUsage(new boolean[] { true, false, true, false, false,
+                false, false, false, false });
+
+        X509CertSelector certSelector = new X509CertSelector();
+
+        certSelector.setKeyUsage(new boolean[] { true, false, true });
+        assertTrue("Assert 1: ", certSelector.match(cert));
+
+        certSelector.setKeyUsage(new boolean[] { true, true, true });
+        assertFalse("Assert 2: ", certSelector.match(cert));
     }
 
     /**



Mime
View raw message