This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new a18b80525a Make test more robust
a18b80525a is described below

commit a18b80525a9f01f2dd9579d9c3f44e2b0b3e1091
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Aug 13 16:01:40 2026 +0100

    Make test more robust
---
 .../tomcat/util/net/ocsp/TestOcspSoftFail.java     | 23 +++++++++++-----------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFail.java 
b/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFail.java
index 699a808ddd..2c3e6bc7e2 100644
--- a/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFail.java
+++ b/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFail.java
@@ -16,10 +16,7 @@
  */
 package org.apache.tomcat.util.net.ocsp;
 
-import java.net.SocketException;
-
-import javax.net.ssl.SSLException;
-import javax.net.ssl.SSLHandshakeException;
+import java.io.IOException;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -44,14 +41,16 @@ public class TestOcspSoftFail extends OcspBaseTest {
     }
 
 
-    @Test(expected = SSLHandshakeException.class)
+    /*
+     * Generally expect to see SSLHandshakeException here. APR or NIO2 may 
throw a SocketException or IOException rather
+     * than a SSLHandshakeException. This hasn't been observed with NIO.
+     *
+     * Different Java versions may throw an SSLException rather than a 
SSLHandshakeException.
+     *
+     * All over these are sub-classes of IOException so check for that.
+     */
+    @Test(expected = IOException.class)
     public void testNoResponderWithoutSoftFail() throws Exception {
-        try {
-            doTest(false, false, ClientCertificateVerification.ENABLED, false, 
Boolean.FALSE);
-        } catch (SocketException | SSLException e) {
-            // APR or NIO2 may throw a SocketException rather than a 
SSLHandshakeException
-            // Different Java versions may throw an SSLException rather than a 
SSLHandshakeException
-            throw new SSLHandshakeException(e.getMessage());
-        }
+        doTest(false, false, ClientCertificateVerification.ENABLED, false, 
Boolean.FALSE);
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to