8282723: Add constructors taking a cause to JSSE exceptions

Reviewed-by: wetmore, iris
This commit is contained in:
Xue-Lei Andrew Fan 2022-03-20 06:46:13 +00:00
parent 3f923b82c3
commit 4df67426ed
30 changed files with 343 additions and 132 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1709,19 +1709,13 @@ public final class SSLSocketImpl
private Plaintext handleEOF(EOFException eofe) throws IOException {
if (requireCloseNotify || conContext.handshakeContext != null) {
SSLException ssle;
if (conContext.handshakeContext != null) {
ssle = new SSLHandshakeException(
"Remote host terminated the handshake");
throw new SSLHandshakeException(
"Remote host terminated the handshake", eofe);
} else {
ssle = new SSLProtocolException(
"Remote host terminated the connection");
throw new SSLProtocolException(
"Remote host terminated the connection", eofe);
}
if (eofe != null) {
ssle.initCause(eofe);
}
throw ssle;
} else {
// treat as if we had received a close_notify
conContext.isInputCloseNotified = true;