OSDN Git Service

Merged gcj-eclipse branch to trunk.
[pf3gnuchains/gcc-fork.git] / libjava / classpath / gnu / java / nio / ServerSocketChannelSelectionKey.java
index d00c2b7..5b510cb 100644 (file)
@@ -38,6 +38,7 @@ exception statement from your version. */
 
 package gnu.java.nio;
 
+import java.io.IOException;
 import java.nio.channels.spi.AbstractSelectableChannel;
 
 public final class ServerSocketChannelSelectionKey
@@ -49,10 +50,16 @@ public final class ServerSocketChannelSelectionKey
     super (channel, selector);
   }
 
+  // FIXME don't use file descriptor integers
   public int getNativeFD()
   {
-    NIOServerSocket socket =
-         (NIOServerSocket) ((ServerSocketChannelImpl) ch).socket();
-    return socket.getPlainSocketImpl().getNativeFD();
+    try
+      {
+        return ((ServerSocketChannelImpl) ch).getVMChannel().getState().getNativeFD();
+      }
+    catch (IOException ioe)
+      {
+        throw new IllegalStateException(ioe);
+      }
   }
 }