private static Collection < X509CRL > getCRLs ( X500Name name , X500Principal certIssuer , List < CertStore > certStores ) throws CertStoreException { if ( debug != null ) { debug . println ( "Trying to fetch CRL from DP " + name ) ; } X509CRLSelector xcs = new X509CRLSelector ( ) ; xcs . addIssuer ( name . asX500Principal ( ) ) ; xcs . addIssuer ( certIssuer ) ; Collection < X509CRL > crls = new ArrayList <> ( ) ; CertStoreException savedCSE = null ; for ( CertStore store : certStores ) { try { for ( CRL crl : store . getCRLs ( xcs ) ) { crls . add ( ( X509CRL ) crl ) ; } } catch ( CertStoreException cse ) { if ( debug != null ) { debug . println ( "Exception while retrieving " + "CRLs: " + cse ) ; cse . printStackTrace ( ) ; } savedCSE = new PKIX . CertStoreTypeException ( store . getType ( ) , cse ) ; } } // only throw CertStoreException if no CRLs are retrieved if ( crls . isEmpty ( ) && savedCSE != null ) { throw savedCSE ; } else { return crls ; } }
Fetch CRLs from certStores .