6938230: (so) SocketAdaptor.close() does not translate IOException resulting in Error

Alan Bateman Alan.Bateman at oracle.com
Wed Jun 9 08:48:47 PDT 2010


Chris - this is networking related one so maybe you could look at it. 
The close method in the socket adapters currently attempt to translate 
any IOException thrown by the the channel close.  This is unnecessary, 
and in the case of SocketChannel's adapter, can result in an Error being 
thrown when it cannot translate the exception. The diffs attach just 
remove this translation. I don't think it's possible to create an 
automated regression test for this.

-Alan.


diff -r a21e3a29ca9d src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
--- a/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java     Tue Jun 
08 18:52:17 2010 -0700
+++ b/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java     Wed Jun 
09 16:43:55 2010 +0100
@@ -144,11 +144,7 @@ public class ServerSocketAdaptor       
     }
 
     public void close() throws IOException {
-        try {
-            ssc.close();
-        } catch (Exception x) {
-            Net.translateException(x);
-        }
+        ssc.close();
     }
 
     public ServerSocketChannel getChannel() {
diff -r a21e3a29ca9d src/share/classes/sun/nio/ch/SocketAdaptor.java
--- a/src/share/classes/sun/nio/ch/SocketAdaptor.java   Tue Jun 08 
18:52:17 2010 -0700
+++ b/src/share/classes/sun/nio/ch/SocketAdaptor.java   Wed Jun 09 
16:43:55 2010 +0100
@@ -404,11 +404,7 @@ public class SocketAdaptor
     }
 
     public void close() throws IOException {
-        try {
-            sc.close();
-        } catch (Exception x) {
-            Net.translateToSocketException(x);
-        }
+        sc.close();
     }
 
     public void shutdownInput() throws IOException {





More information about the nio-dev mailing list