+2004-07-17 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/net/DatagramPacket.java (setAddress): Removed check for
+ null address.
+
+2004-07-17 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocket.java
+ (getLocalAddress): Check if socket is bound or not.
+ * java/net/Socket.java
+ (getLocalAddrss): Check if socket is bound or not.
+ (getPort): Return -1 when not connected. Dont check getImpl() for
+ null.
+ (setReuseAddress): Check if socket is closed.
+ (isConnected): Check if getImpl() returns null.
+
2004-07-17 Mark Wielaard <mark@klomp.org>
* java/awt/event/InvocationEvent.java (dispatch): Synchronize
*/
public synchronized void setAddress(InetAddress address)
{
- if (address == null)
- throw new NullPointerException("Null address");
-
this.address = address;
}
/* DatagramSocket.java -- A class to model UDP sockets
- Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
*/
public InetAddress getLocalAddress()
{
- if (isClosed())
+ if (! isBound())
return null;
InetAddress localAddr;
*/
public InetAddress getLocalAddress()
{
+ if (! isBound())
+ return null;
+
InetAddress addr = null;
try
public int getPort()
{
if (! isConnected())
- return 0;
+ return -1;
try
{
- if (getImpl() != null)
- return getImpl().getPort();
+ return getImpl().getPort();
}
catch (SocketException e)
{
*/
public void setReuseAddress(boolean reuseAddress) throws SocketException
{
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
getImpl().setOption(SocketOptions.SO_REUSEADDR,
Boolean.valueOf(reuseAddress));
}
{
try
{
+ if (getImpl() == null)
+ return false;
+
return getImpl().getInetAddress() != null;
}
catch (SocketException e)