changeset 15269:0a626adb5cc0

8005939: sun/security/x509/{X509CRLImplX509CertImpl}/Verify.java fail in confusing way when some providers not present Reviewed-by: mullan, weijun
author juh
date Wed, 16 Jan 2013 13:35:17 -0500
parents d815f9973d97
children e2777acce5f3
files jdk/test/sun/security/x509/X509CRLImpl/Verify.java jdk/test/sun/security/x509/X509CertImpl/Verify.java
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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);
     }
 }