This is an automated email from the ASF dual-hosted git repository.
rainerjung pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 22302ba916 Improve test reliability with Java 8.
22302ba916 is described below
commit 22302ba916863c8bf67c362fd658f58ab7cf4a6e
Author: Rainer Jung <[email protected]>
AuthorDate: Sun May 3 14:54:43 2026 +0200
Improve test reliability with Java 8.
Sometimes the test fails on Java 8 with:
javax.net.ssl.SSLException: readHandshakeRecord
---
.../tomcat/util/net/ocsp/TestOcspSoftFailInternalError.java | 11 +++++++++++
.../apache/tomcat/util/net/ocsp/TestOcspSoftFailTryLater.java | 11 +++++++++++
2 files changed, 22 insertions(+)
diff --git
a/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFailInternalError.java
b/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFailInternalError.java
index 16cb573aa9..5d95f1fbea 100644
--- a/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFailInternalError.java
+++ b/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFailInternalError.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
import org.junit.AfterClass;
@@ -33,6 +34,7 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
+import org.apache.tomcat.util.compat.JreCompat;
import org.apache.tomcat.util.net.ocsp.TesterOcspResponder.OcspResponse;
@RunWith(Parameterized.class)
@@ -103,6 +105,15 @@ public class TestOcspSoftFailInternalError extends
OcspBaseTest {
Assert.fail("Handshake did not fail when expected to do so.");
}
} catch (SSLHandshakeException | SocketException e) {
+ if (!handshakeFailureExpected) {
+ System.out.println("ZZZ e: " + e);
+ Assert.fail("Handshake failed when not expected to do so.");
+ }
+ // Java 8 might throw SSLException instead of SSLHandshakeException
+ } catch (SSLException e) {
+ if (JreCompat.isJre9Available()) {
+ throw(e);
+ }
if (!handshakeFailureExpected) {
Assert.fail("Handshake failed when not expected to do so.");
}
diff --git a/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFailTryLater.java
b/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFailTryLater.java
index 3bf148d32e..2abf56393a 100644
--- a/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFailTryLater.java
+++ b/test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFailTryLater.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
import org.junit.AfterClass;
@@ -33,6 +34,7 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
+import org.apache.tomcat.util.compat.JreCompat;
import org.apache.tomcat.util.net.ocsp.TesterOcspResponder.OcspResponse;
@RunWith(Parameterized.class)
@@ -103,6 +105,15 @@ public class TestOcspSoftFailTryLater extends OcspBaseTest
{
Assert.fail("Handshake did not fail when expected to do so.");
}
} catch (SSLHandshakeException | SocketException e) {
+ if (!handshakeFailureExpected) {
+ System.out.println("ZZZ e: " + e);
+ Assert.fail("Handshake failed when not expected to do so.");
+ }
+ // Java 8 might throw SSLException instead of SSLHandshakeException
+ } catch (SSLException e) {
+ if (JreCompat.isJre9Available()) {
+ throw(e);
+ }
if (!handshakeFailureExpected) {
Assert.fail("Handshake failed when not expected to do so.");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]