8204233: Add configurable option for enhanced socket IOException messages

Reviewed-by: alanb, chegar
This commit is contained in:
Michael McMahon 2018-06-22 18:10:20 +01:00
parent 7d4135b630
commit 1d79d38007
7 changed files with 269 additions and 8 deletions

View file

@ -32,6 +32,7 @@ import java.util.concurrent.*;
import java.io.IOException;
import java.io.FileDescriptor;
import sun.net.NetHooks;
import sun.net.util.SocketExceptions;
import sun.security.action.GetPropertyAction;
/**
@ -258,6 +259,10 @@ class UnixAsynchronousSocketChannelImpl
end();
}
if (e != null) {
if (e instanceof IOException) {
var isa = (InetSocketAddress)pendingRemote;
e = SocketExceptions.of((IOException)e, isa);
}
// close channel if connection cannot be established
try {
close();
@ -350,6 +355,9 @@ class UnixAsynchronousSocketChannelImpl
// close channel if connect fails
if (e != null) {
if (e instanceof IOException) {
e = SocketExceptions.of((IOException)e, isa);
}
try {
close();
} catch (Throwable suppressed) {