src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java
changeset 50722 bc104aaf24e9
parent 47216 71c04702a3d5
--- a/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java	Fri Jun 22 18:19:26 2018 +0200
+++ b/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java	Fri Jun 22 18:10:20 2018 +0100
@@ -35,6 +35,7 @@
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import jdk.internal.misc.Unsafe;
+import sun.net.util.SocketExceptions;
 
 /**
  * Windows implementation of AsynchronousSocketChannel using overlapped I/O.
@@ -253,7 +254,8 @@
 
             if (exc != null) {
                 closeChannel();
-                result.setFailure(toIOException(exc));
+                exc = SocketExceptions.of(toIOException(exc), remote);
+                result.setFailure(exc);
             }
             Invoker.invoke(result);
         }
@@ -278,7 +280,9 @@
             // can't close channel while in begin/end block
             if (exc != null) {
                 closeChannel();
-                result.setFailure(toIOException(exc));
+                IOException ee = toIOException(exc);
+                ee = SocketExceptions.of(ee, remote);
+                result.setFailure(ee);
             }
 
             if (canInvokeDirect) {
@@ -293,11 +297,13 @@
          */
         @Override
         public void failed(int error, IOException x) {
+            x = SocketExceptions.of(x, remote);
             if (isOpen()) {
                 closeChannel();
                 result.setFailure(x);
             } else {
-                result.setFailure(new AsynchronousCloseException());
+                x = SocketExceptions.of(new AsynchronousCloseException(), remote);
+                result.setFailure(x);
             }
             Invoker.invoke(result);
         }