@@ -116,7 +116,29 @@ public List<RevocationInfo> validateCertificateNotRevoked(X509Certificate subjec
116116 List <RevocationInfo > revocationInfoList = new ArrayList <>();
117117
118118 CheckedFunction0 <RevocationInfo > primarySupplier = () -> request (ocspService , subjectCertificate , issuerCertificate , false );
119- CheckedFunction0 <RevocationInfo > fallbackSupplier = () -> request (ocspService .getFallbackService (), subjectCertificate , issuerCertificate , true );
119+ OcspService firstFallbackService = ocspService .getFallbackService ();
120+ CheckedFunction0 <RevocationInfo > firstFallbackSupplier = () -> request (firstFallbackService , subjectCertificate , issuerCertificate , true );
121+ OcspService secondFallbackService = getOcspServiceProvider ().getFallbackService (firstFallbackService .getAccessLocation ());
122+ CheckedFunction0 <RevocationInfo > fallbackSupplier ;
123+ if (secondFallbackService == null ) {
124+ fallbackSupplier = firstFallbackSupplier ;
125+ } else {
126+ CheckedFunction0 <RevocationInfo > secondFallbackSupplier = () -> request (secondFallbackService , subjectCertificate , issuerCertificate , true );
127+ fallbackSupplier = () -> {
128+ try {
129+ return firstFallbackSupplier .apply ();
130+ } catch (Exception e ) {
131+ if (e instanceof ResilientUserCertificateOCSPCheckFailedException exception ) {
132+ revocationInfoList .addAll ((exception .getValidationInfo ().revocationInfoList ()));
133+ } else {
134+ revocationInfoList .add (new RevocationInfo (null , Map .ofEntries (
135+ Map .entry (RevocationInfo .KEY_OCSP_ERROR , e )
136+ )));
137+ }
138+ return secondFallbackSupplier .apply ();
139+ }
140+ };
141+ }
120142 Decorators .DecorateCheckedSupplier <RevocationInfo > decorateCheckedSupplier = Decorators .ofCheckedSupplier (primarySupplier );
121143 if (retryRegistry != null ) {
122144 Retry retry = retryRegistry .retry (ocspService .getAccessLocation ().toASCIIString ());
0 commit comments