8282686: Add constructors taking a cause to SocketException

Reviewed-by: alanb, xuelei, lancea, dfuchs
This commit is contained in:
Joe Darcy 2022-03-07 17:52:04 +00:00
parent 7194097bca
commit 1faa5c8092
7 changed files with 90 additions and 25 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -120,12 +120,8 @@ public abstract class SocketFactory
// The Exception is used by HttpsClient to signal that
// unconnected sockets have not been implemented.
//
UnsupportedOperationException uop = new
UnsupportedOperationException();
SocketException se = new SocketException(
"Unconnected sockets not implemented");
se.initCause(uop);
throw se;
throw new SocketException("Unconnected sockets not implemented",
new UnsupportedOperationException());
}

View file

@ -173,8 +173,7 @@ class DefaultSSLServerSocketFactory extends SSLServerSocketFactory {
}
private ServerSocket throwException() throws SocketException {
throw (SocketException)
new SocketException(reason.toString()).initCause(reason);
throw new SocketException(reason.toString(), reason);
}
@Override

View file

@ -263,8 +263,7 @@ class DefaultSSLSocketFactory extends SSLSocketFactory
}
private Socket throwException() throws SocketException {
throw (SocketException)
new SocketException(reason.toString()).initCause(reason);
throw new SocketException(reason.toString(), reason);
}
@Override