This PR improves the exceptions thrown from HttpClient.send when the QUIC TLS handshake fails on the client side, for example because the server certificate is not trusted.
Before the changes we would throw the following exception chain: javax.net.ssl.SSLHandshakeException: QUIC connection establishment failed Caused by: javax.net.ssl.SSLHandshakeException: QUIC connection establishment failed Caused by: java.io.IOException: certificate_unknown After the changes the following exception chain is thrown: javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Caused by: javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target The new exception chain matches the one observed with HTTP 1/2. I updated a preexisting test to cover HTTP3, and added assertions to verify the exception message. HttpClient tests continue to pass. ------------- Commit messages: - Add bug ID - Add test - Use original exception as the reported cause when possible Changes: https://git.openjdk.org/jdk/pull/30563/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=30563&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8381316 Stats: 48 lines in 3 files changed: 21 ins; 9 del; 18 mod Patch: https://git.openjdk.org/jdk/pull/30563.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/30563/head:pull/30563 PR: https://git.openjdk.org/jdk/pull/30563
