[kaffe] CVS kaffe (kaz): libraries/javalib/java/net/Socket.java

Kaffe CVS cvs-commits at kaffe.org
Tue Sep 14 07:19:46 PDT 2004


PatchSet 5165 
Date: 2004/09/14 14:15:48
Author: kaz
Branch: HEAD
Tag: (none) 
Log:
2004-09-14  Ito Kazumitsu  <kaz at maczuka.gcd.org>

	* libraries/javalib/java/net/Socket.java
	(getLocalAddress()): If the socket is not bound yet,
	return InetAddress.ANY_IF rather than null.

Members: 
	ChangeLog:1.2720->1.2721 
	libraries/javalib/java/net/Socket.java:1.35->1.36 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2720 kaffe/ChangeLog:1.2721
--- kaffe/ChangeLog:1.2720	Mon Sep 13 13:20:41 2004
+++ kaffe/ChangeLog	Tue Sep 14 14:15:48 2004
@@ -1,3 +1,9 @@
+2004-09-14  Ito Kazumitsu  <kaz at maczuka.gcd.org>
+
+	* libraries/javalib/java/net/Socket.java
+	(getLocalAddress()): If the socket is not bound yet,
+	return InetAddress.ANY_IF rather than null.
+
 2004-09-13  Dalibor Topic  <robilad at kaffe.org>
 
 	* libraries/clib/native/TimeZone.c:
Index: kaffe/libraries/javalib/java/net/Socket.java
diff -u kaffe/libraries/javalib/java/net/Socket.java:1.35 kaffe/libraries/javalib/java/net/Socket.java:1.36
--- kaffe/libraries/javalib/java/net/Socket.java:1.35	Mon Jul 26 21:13:57 2004
+++ kaffe/libraries/javalib/java/net/Socket.java	Tue Sep 14 14:15:51 2004
@@ -479,7 +479,8 @@
 
   /**
    * Returns the local address to which this socket is bound.  If this socket
-   * is not connected, then <code>null</code> is returned.
+   * is not connected, then a wildcard address, for which isAnyLocalAddress()
+   * is true, is returned.
    *
    * @return The local address
    *
@@ -487,21 +488,25 @@
    */
   public InetAddress getLocalAddress()
   {
-    if (! isBound())
-      return null;
-
     InetAddress addr = null;
 
-    try
+    if (! isBound())
       {
-	addr = (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR);
+        addr = InetAddress.ANY_IF;
       }
-    catch (SocketException e)
+    else
       {
-	// (hopefully) shouldn't happen
-	// throw new java.lang.InternalError
-	//      ("Error in PlainSocketImpl.getOption");
-	return null;
+        try
+          {
+	    addr = (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR);
+          }
+        catch (SocketException e)
+          {
+	    // (hopefully) shouldn't happen
+	    // throw new java.lang.InternalError
+	    //      ("Error in PlainSocketImpl.getOption");
+	    return null;
+          }
       }
 
     // FIXME: According to libgcj, checkConnect() is supposed to be called




More information about the kaffe mailing list