From 9fd6479043b30a8abb901d481d0f6422f0af4fda Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Thu, 18 Sep 2003 11:32:46 +0000 Subject: [PATCH] 2003-09-18 Michael Koch * java/net/DatagramSocket.java (ch): Removed. (receive): Use getChannel() instead of ch. (send): Likewise. (getChannel): Return null. * java/net/ServerSocket.java (ch): Removed. (setChannel): Removed. (implAccept): Use getChannel() instead of ch. (close): Likewise. (getChannel): Return null. * java/net/Socket.java (ch): Removed. (connect): Use getChannel() instead of ch. (setChannel): Removed. (getChannel): Return null. From-SVN: r71516 --- libjava/ChangeLog | 19 +++++++++++++++++++ libjava/java/net/DatagramSocket.java | 14 +++++--------- libjava/java/net/ServerSocket.java | 23 +++++------------------ libjava/java/net/Socket.java | 20 +++++--------------- 4 files changed, 34 insertions(+), 42 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index cb041747540..3a1cadc927e 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,22 @@ +2003-09-18 Michael Koch + + * java/net/DatagramSocket.java + (ch): Removed. + (receive): Use getChannel() instead of ch. + (send): Likewise. + (getChannel): Return null. + * java/net/ServerSocket.java + (ch): Removed. + (setChannel): Removed. + (implAccept): Use getChannel() instead of ch. + (close): Likewise. + (getChannel): Return null. + * java/net/Socket.java + (ch): Removed. + (connect): Use getChannel() instead of ch. + (setChannel): Removed. + (getChannel): Return null. + 2003-09-18 Mark Wielaard Reported by Guilhem Lavaux and Julian Dolby diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java index 401bcb82697..4cc8e50f0d5 100644 --- a/libjava/java/net/DatagramSocket.java +++ b/libjava/java/net/DatagramSocket.java @@ -74,12 +74,6 @@ public class DatagramSocket */ DatagramSocketImpl impl; - /** - * The unique DatagramChannel object associated with this datagram socket, - * or null. - */ - DatagramChannel ch; - /** * This is the address we are "connected" to */ @@ -519,7 +513,8 @@ public class DatagramSocket throw new IOException ( "Socket connected to a multicast address my not receive"); - if (ch != null && !ch.isBlocking ()) + if (getChannel() != null + && !getChannel().isBlocking ()) throw new IllegalBlockingModeException (); impl.receive(p); @@ -568,7 +563,8 @@ public class DatagramSocket // FIXME: if this is a subclass of MulticastSocket, // use getTimeToLive for TTL val. - if (ch != null && !ch.isBlocking ()) + if (getChannel() != null + && !getChannel().isBlocking ()) throw new IllegalBlockingModeException (); impl.send(p); @@ -618,7 +614,7 @@ public class DatagramSocket */ public DatagramChannel getChannel() { - return ch; + return null; } /** diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index 4e6d7092dec..44281783dc8 100644 --- a/libjava/java/net/ServerSocket.java +++ b/libjava/java/net/ServerSocket.java @@ -73,12 +73,6 @@ public class ServerSocket */ private SocketImpl impl; - /** - * ServerSocketChannel of this ServerSocket. This channel only exists - * when the socket is created by ServerSocketChannel.open(). - */ - private ServerSocketChannel ch; - private boolean closed = false; /** @@ -160,14 +154,6 @@ public class ServerSocket bind (new InetSocketAddress (bindAddr, port), backlog); } - /* - * This method may only be used by java.nio.channels.ServerSocketChannel.open. - */ - void setChannel (ServerSocketChannel ch) - { - this.ch = ch; - } - /** * Binds the server socket to a specified socket address * @@ -318,7 +304,8 @@ public class ServerSocket protected final void implAccept (Socket s) throws IOException { - if (ch != null && !ch.isBlocking()) + if (getChannel() != null + && !getChannel().isBlocking()) throw new IllegalBlockingModeException(); impl.accept(s.impl); @@ -334,8 +321,8 @@ public class ServerSocket if (impl != null) impl.close (); - if (ch != null) - ch.close (); + if (getChannel() != null) + getChannel().close (); closed = true; } @@ -351,7 +338,7 @@ public class ServerSocket */ public ServerSocketChannel getChannel() { - return ch; + return null; } /** diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java index 90dfac26763..a5397bf7a49 100644 --- a/libjava/java/net/Socket.java +++ b/libjava/java/net/Socket.java @@ -87,8 +87,6 @@ public class Socket private boolean inputShutdown = false; private boolean outputShutdown = false; - SocketChannel ch; // this field must have been set if created by SocketChannel - private boolean closed = false; /** @@ -298,15 +296,6 @@ public class Socket // that default. JDK 1.2 doc infers not to do a bind. } - /* - * This method may only be used by java.nio.channels.ServerSocketChannel.accept and - * java.nio.channels.SocketChannel.open. - */ - void setChannel (SocketChannel ch) - { - this.ch = ch; - } - /** * Binds the socket to the givent local address/port * @@ -401,7 +390,8 @@ public class Socket if (! (endpoint instanceof InetSocketAddress)) throw new IllegalArgumentException ("Address type not supported"); - if (ch != null && !ch.isBlocking ()) + if (getChannel() != null + && !getChannel().isBlocking ()) throw new IllegalBlockingModeException (); if (!isBound ()) @@ -882,8 +872,8 @@ public class Socket if (impl != null) impl.close(); - if (ch != null) - ch.close(); + if (getChannel() != null) + getChannel().close(); closed = true; } @@ -970,7 +960,7 @@ public class Socket */ public SocketChannel getChannel() { - return ch; + return null; } /**