8005939: sun/security/x509/{X509CRLImplX509CertImpl}/Verify.java fail in confusing way when some providers not present
authorjuh
Wed, 16 Jan 2013 13:35:17 -0500
changeset 15269 0a626adb5cc0
parent 15268 d815f9973d97
child 15270 e2777acce5f3
8005939: sun/security/x509/{X509CRLImplX509CertImpl}/Verify.java fail in confusing way when some providers not present Reviewed-by: mullan, weijun
jdk/test/sun/security/x509/X509CRLImpl/Verify.java
jdk/test/sun/security/x509/X509CertImpl/Verify.java
--- a/jdk/test/sun/security/x509/X509CRLImpl/Verify.java	Wed Jan 16 09:51:21 2013 -0500
+++ b/jdk/test/sun/security/x509/X509CRLImpl/Verify.java	Wed Jan 16 13:35:17 2013 -0500
@@ -95,7 +95,7 @@
          * Should fail with NoSuchAlgorithmException.
          */
         try {
-            verifyCRL(crlIssuerCertPubKey, "SunPCSC");
+            verifyCRL(crlIssuerCertPubKey, "SunJCE");
             throw new RuntimeException("Didn't catch the exception properly");
         } catch (NoSuchAlgorithmException e) {
             System.out.println("Caught the correct exception.");
@@ -148,6 +148,10 @@
             throws CRLException, NoSuchAlgorithmException, InvalidKeyException,
             SignatureException {
         Provider provider = Security.getProvider(providerName);
+        if (provider == null) {
+            throw new RuntimeException("Provider " + providerName
+                                                   + " not found.");
+        }
         crl.verify(key, provider);
     }
 }
--- a/jdk/test/sun/security/x509/X509CertImpl/Verify.java	Wed Jan 16 09:51:21 2013 -0500
+++ b/jdk/test/sun/security/x509/X509CertImpl/Verify.java	Wed Jan 16 13:35:17 2013 -0500
@@ -86,7 +86,7 @@
          * Should fail with NoSuchAlgorithmException.
          */
         try {
-            verifyCert(selfSignedCertPubKey, "SunPCSC");
+            verifyCert(selfSignedCertPubKey, "SunJCE");
             throw new RuntimeException("Didn't catch the exception properly");
         } catch (NoSuchAlgorithmException e) {
             System.out.println("Caught the correct exception.");
@@ -134,6 +134,10 @@
             throws CertificateException, NoSuchAlgorithmException,
             InvalidKeyException, SignatureException {
         Provider provider = Security.getProvider(providerName);
+        if (provider == null) {
+            throw new RuntimeException("Provider " + providerName
+                                                   + " not found.");
+        }
         cert.verify(key, provider);
     }
 }