From 3b1748292c2c4e06296bec703cab069fb8d8f555 Mon Sep 17 00:00:00 2001 From: juh Date: Wed, 16 Jan 2013 13:35:17 -0500 Subject: [PATCH] 8005939: sun/security/x509/{X509CRLImplX509CertImpl}/Verify.java fail in confusing way when some providers not present Reviewed-by: mullan, weijun --- test/sun/security/x509/X509CRLImpl/Verify.java | 6 +++++- test/sun/security/x509/X509CertImpl/Verify.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/sun/security/x509/X509CRLImpl/Verify.java b/test/sun/security/x509/X509CRLImpl/Verify.java index f55f1bffb..0c1b30d74 100644 --- a/test/sun/security/x509/X509CRLImpl/Verify.java +++ b/test/sun/security/x509/X509CRLImpl/Verify.java @@ -95,7 +95,7 @@ public class Verify { * 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 @@ public class Verify { throws CRLException, NoSuchAlgorithmException, InvalidKeyException, SignatureException { Provider provider = Security.getProvider(providerName); + if (provider == null) { + throw new RuntimeException("Provider " + providerName + + " not found."); + } crl.verify(key, provider); } } diff --git a/test/sun/security/x509/X509CertImpl/Verify.java b/test/sun/security/x509/X509CertImpl/Verify.java index 09c1e0e1b..89dcbb9f1 100644 --- a/test/sun/security/x509/X509CertImpl/Verify.java +++ b/test/sun/security/x509/X509CertImpl/Verify.java @@ -86,7 +86,7 @@ public class Verify { * 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 @@ public class Verify { throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, SignatureException { Provider provider = Security.getProvider(providerName); + if (provider == null) { + throw new RuntimeException("Provider " + providerName + + " not found."); + } cert.verify(key, provider); } } -- GitLab