mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8253635: Implement toString() for SSLEngineImpl
Reviewed-by: coffeys, wetmore
This commit is contained in:
parent
c6d798c25a
commit
65bed6470c
2 changed files with 30 additions and 24 deletions
|
@ -35,7 +35,6 @@ import java.net.InetSocketAddress;
|
|||
import java.net.Socket;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -135,7 +134,7 @@ public final class SSLSocketImpl
|
|||
* if appropriate.
|
||||
*/
|
||||
SSLSocketImpl(SSLContextImpl sslContext, String peerHost,
|
||||
int peerPort) throws IOException, UnknownHostException {
|
||||
int peerPort) throws IOException {
|
||||
super();
|
||||
this.sslContext = sslContext;
|
||||
HandshakeHash handshakeHash = new HandshakeHash();
|
||||
|
@ -179,7 +178,7 @@ public final class SSLSocketImpl
|
|||
*/
|
||||
SSLSocketImpl(SSLContextImpl sslContext,
|
||||
String peerHost, int peerPort, InetAddress localAddr,
|
||||
int localPort) throws IOException, UnknownHostException {
|
||||
int localPort) throws IOException {
|
||||
super();
|
||||
this.sslContext = sslContext;
|
||||
HandshakeHash handshakeHash = new HandshakeHash();
|
||||
|
@ -1406,11 +1405,9 @@ public final class SSLSocketImpl
|
|||
conContext.isNegotiated) {
|
||||
return 0;
|
||||
}
|
||||
} catch (SSLException ssle) {
|
||||
throw ssle;
|
||||
} catch (InterruptedIOException iioe) {
|
||||
} catch (SSLException | InterruptedIOException ssle) {
|
||||
// don't change exception in case of timeouts or interrupts
|
||||
throw iioe;
|
||||
throw ssle;
|
||||
} catch (IOException ioe) {
|
||||
throw new SSLException("readHandshakeRecord", ioe);
|
||||
}
|
||||
|
@ -1471,17 +1468,11 @@ public final class SSLSocketImpl
|
|||
buffer.position() > 0) {
|
||||
return buffer;
|
||||
}
|
||||
} catch (SSLException ssle) {
|
||||
throw ssle;
|
||||
} catch (InterruptedIOException iioe) {
|
||||
} catch (SSLException | InterruptedIOException ssle) {
|
||||
// don't change exception in case of timeouts or interrupts
|
||||
throw iioe;
|
||||
throw ssle;
|
||||
} catch (IOException ioe) {
|
||||
if (!(ioe instanceof SSLException)) {
|
||||
throw new SSLException("readApplicationRecord", ioe);
|
||||
} else {
|
||||
throw ioe;
|
||||
}
|
||||
throw new SSLException("readApplicationRecord", ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1738,19 +1729,25 @@ public final class SSLSocketImpl
|
|||
}
|
||||
|
||||
try {
|
||||
if (conContext.isInputCloseNotified) {
|
||||
// Close the connection, no wait for more peer response.
|
||||
closeSocket(false);
|
||||
} else {
|
||||
// Close the connection, may wait for peer close_notify.
|
||||
closeSocket(true);
|
||||
}
|
||||
// If conContext.isInputCloseNotified is false, close the
|
||||
// connection, no wait for more peer response. Otherwise,
|
||||
// may wait for peer close_notify.
|
||||
closeSocket(!conContext.isInputCloseNotified);
|
||||
} finally {
|
||||
tlsIsClosed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SSLSocket[" +
|
||||
"hostname=" + getPeerHost() +
|
||||
", port=" + getPeerPort() +
|
||||
", " + conContext.conSession + // SSLSessionImpl.toString()
|
||||
"]";
|
||||
}
|
||||
|
||||
private void closeSocket(boolean selfInitiated) throws IOException {
|
||||
if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
|
||||
SSLLogger.fine("close the SSL connection " +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue