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

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


The following commit(s) were added to refs/heads/main by this push:
     new f6712130d1 Re-work fix to use existing Tomcat 9 approach - it is 
cleaner
f6712130d1 is described below

commit f6712130d1555865331875fa314cf3756609458a
Author: Mark Thomas <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to