From 07515641a55ffacad7a289e32702831f54630d07 Mon Sep 17 00:00:00 2001 From: Warren Levy Date: Fri, 28 May 1999 19:29:53 +0000 Subject: DatagramSocket.java (laddr): Removed. * java/net/DatagramSocket.java (laddr): Removed. (DatagramSocket): Removed attempts to get or set laddr if null. (getLocalAddress): Reimplemented per spec. * java/net/MulticastSocket.java (setTimeToLive): Throw exception when ttl is 0. (joinGroup): Throw NullPointerException if any argument is null. (leaveGroup): ditto. * java/net/PlainDatagramSocketImpl.java: Updated comments. * java/net/PlainSocketImpl.java (timeout): Added. (getInputStream): Added FIXME comment on how to support timeouts for TCP. * java/net/ServerSocket.java (ServerSocket): Added FIXME comment. * java/net/Socket.java: Added FIXME comments to identify conflicting specs between the JCL and JDK 1.2 documents. * java/net/natPlainDatagramSocketImpl.cc (bind): Use INADDR_ANY if host is null. Get localport value resolved by kernel if bind lport is 0. (receive): Implemented support for timeouts in UDP. (setOption): Implemented based on natPlainSocketImpl version. (getOption): ditto. * java/net/natPlainSocketImpl.cc (bind): Get localport value resolved by kernel if bind lport is 0. (connect): Get localport value resolved by kernel if bind wasn't done to set localport. (accept): Implemented support for timeouts for ServerSocket. (setOption): Save value for SO_TIMEOUT. (getOption): Return timeout for SO_TIMEOUT. From-SVN: r27230 --- libjava/java/net/MulticastSocket.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libjava/java/net/MulticastSocket.java') diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java index 03a6e6b175c..6759e3bc3ca 100644 --- a/libjava/java/net/MulticastSocket.java +++ b/libjava/java/net/MulticastSocket.java @@ -76,7 +76,7 @@ public class MulticastSocket extends DatagramSocket // JDK1.2 public void setTimeToLive(int ttl) throws IOException { - if (ttl < 0 || ttl > 255) + if (ttl <= 0 || ttl > 255) throw new IllegalArgumentException("Invalid ttl: " + ttl); impl.setTimeToLive(ttl); @@ -84,6 +84,10 @@ public class MulticastSocket extends DatagramSocket public void joinGroup(InetAddress mcastaddr) throws IOException { + // FIXME: We can't currently rely on NullPointerException being + // thrown when we invoke a method on a null object. + if (mcastaddr == null) + throw new NullPointerException("Null address"); if (! mcastaddr.isMulticastAddress()) throw new IOException("Not a Multicast address"); @@ -96,6 +100,10 @@ public class MulticastSocket extends DatagramSocket public void leaveGroup(InetAddress mcastaddr) throws IOException { + // FIXME: We can't currently rely on NullPointerException being + // thrown when we invoke a method on a null object. + if (mcastaddr == null) + throw new NullPointerException("Null address"); if (! mcastaddr.isMulticastAddress()) throw new IOException("Not a Multicast address"); -- cgit v1.2.1