(tomcat) branch 10.1.x updated: Make test more robust

[email protected]
Newsgroups gmane.comp.jakarta.tomcat.devel
Message-ID <178663342816.1506111.17636369958430129732@gitbox3-he-fi.apache.org>
This is an automated email from the ASF dual-hosted git repository.

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


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

commit 9e18d53aa4bfe093d11fdc08665769fe91376876
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);
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.