8214339: SSLSocketImpl erroneously wraps SocketException

Reviewed-by: ascarpino, jnimeh
This commit is contained in:
Xue-Lei Andrew Fan 2018-12-14 19:39:39 -08:00
parent e44207a9f6
commit 3933c8477b
6 changed files with 726 additions and 25 deletions

View file

@ -122,11 +122,17 @@ enum Alert {
reason = (cause != null) ? cause.getMessage() : "";
}
SSLException ssle = (this == UNEXPECTED_MESSAGE) ?
new SSLProtocolException(reason) :
(handshakeOnly ?
new SSLHandshakeException(reason) :
new SSLException(reason));
SSLException ssle;
if ((cause != null) && (cause instanceof IOException)) {
ssle = new SSLException(reason);
} else if ((this == UNEXPECTED_MESSAGE)) {
ssle = new SSLProtocolException(reason);
} else if (handshakeOnly) {
ssle = new SSLHandshakeException(reason);
} else {
ssle = new SSLException(reason);
}
if (cause != null) {
ssle.initCause(cause);
}