You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2026/06/18 07:56:09 UTC

(tomcat) branch 11.0.x updated: Re-work fix to use existing Tomcat 9 approach - it is cleaner

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 0fd5f31691 Re-work fix to use existing Tomcat 9 approach - it is cleaner
0fd5f31691 is described below

commit 0fd5f316919b3f96596be7452e2eb112ce50b066
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jun 18 08:55:41 2026 +0100

    Re-work fix to use existing Tomcat 9 approach - it is cleaner
---
 .../tomcat/util/net/TestSslHandshakeFailure.java    | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/test/org/apache/tomcat/util/net/TestSslHandshakeFailure.java b/test/org/apache/tomcat/util/net/TestSslHandshakeFailure.java
index 0b0d49d69b..ba33e26bc1 100644
--- a/test/org/apache/tomcat/util/net/TestSslHandshakeFailure.java
+++ b/test/org/apache/tomcat/util/net/TestSslHandshakeFailure.java
@@ -26,7 +26,6 @@ import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLHandshakeException;
 
-import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameter;
@@ -78,24 +77,12 @@ public class TestSslHandshakeFailure extends TomcatBaseTest {
         sc.init(null, TesterSupport.getTrustManagers(), null);
         HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
 
-        Throwable actual = null;
         try {
             getUrl("https://localhost:" + getPort() + "/");
-        } catch (Throwable t) {
-            actual = t;
-        }
-
-        /*
-         * SSLHandshakeException expected but SocketException has been observed
-         */
-        Assert.assertNotNull("No exception was thrown when SSLHandshakeException was expected", actual);
-
-        if (actual instanceof SSLHandshakeException || actual instanceof SocketException) {
-            // Tests passes = NO-OP
-        } else {
-            actual.printStackTrace();
-            Assert.fail("Unexpected exception [" + actual.getClass() + ": " + actual.getMessage() + "].");
+        } catch (SSLHandshakeException t) {
+            // Expected
+        } catch (SocketException e) {
+            // Expected - SocketException has also been observed (less often)
         }
     }
-
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org