changeset 6958:4f22a749cb7e

8035973: NPE in ForwardBuilder Reviewed-by: xuelei, mullan
author juh
date Tue, 04 Mar 2014 01:36:39 +0000
parents 1232278c9e24
children 9c978bb7718b
files src/share/classes/sun/security/provider/certpath/ForwardBuilder.java
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Fri Feb 28 16:48:51 2014 +0000
+++ b/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Tue Mar 04 01:36:39 2014 +0000
@@ -375,20 +375,22 @@
         boolean add = false;
         for (AccessDescription ad : adList) {
             CertStore cs = URICertStore.getInstance(ad);
-            try {
-                if (certs.addAll((Collection<X509Certificate>)
-                    cs.getCertificates(caSelector))) {
-                    add = true;
-                    if (!searchAllCertStores) {
-                        return true;
+            if (cs != null) {
+                try {
+                    if (certs.addAll((Collection<X509Certificate>)
+                            cs.getCertificates(caSelector))) {
+                        add = true;
+                        if (!searchAllCertStores) {
+                            return true;
+                        }
                     }
+                } catch (CertStoreException cse) {
+                    if (debug != null) {
+                        debug.println("exception getting certs from CertStore:");
+                        cse.printStackTrace();
+                    }
+                    continue;
                 }
-            } catch (CertStoreException cse) {
-                if (debug != null) {
-                    debug.println("exception getting certs from CertStore:");
-                    cse.printStackTrace();
-                }
-                continue;
             }
         }
         return add;