Skip to content

Commit 4e4bdd9

Browse files
committed
Align with 9.0.x
Better handles failure modes with some newer versions of Java
1 parent df9d00a commit 4e4bdd9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/org/apache/tomcat/util/net/ocsp/TestOcspSoftFail.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
*/
1717
package org.apache.tomcat.util.net.ocsp;
1818

19+
import java.net.SocketException;
20+
21+
import javax.net.ssl.SSLException;
1922
import javax.net.ssl.SSLHandshakeException;
2023

2124
import org.junit.Test;
@@ -43,6 +46,13 @@ public void testNoResponderWithSoftFail() throws Exception {
4346

4447
@Test(expected = SSLHandshakeException.class)
4548
public void testNoResponderWithoutSoftFail() throws Exception {
46-
doTest(false, false, ClientCertificateVerification.ENABLED, false, Boolean.FALSE);
49+
try {
50+
doTest(false, false, ClientCertificateVerification.ENABLED, false, Boolean.FALSE);
51+
} catch (SocketException | SSLException e) {
52+
// APR or NIO2 may throw a SocketException rather than a SSLHandshakeException. Not observed with NIO but
53+
// for consistency / just in case.
54+
// Different Java versions may throw an SSLException rather than a SSLHandshakeException
55+
throw new SSLHandshakeException(e.getMessage());
56+
}
4757
}
4858
}

0 commit comments

Comments
 (0)