2003-05-05 Michael Koch <konqueror@gmx.de>
authorMichael Koch <konqueror@gmx.de>
Mon, 5 May 2003 20:18:31 +0000 (20:18 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Mon, 5 May 2003 20:18:31 +0000 (20:18 +0000)
* java/net/NetworkInterface.java
(networkInterfaces): Removed.
(getByName): Use getRealNetworkInterfaces() instead of
networkInterfaces.
(getByInetAddress): Likewise.
(getNetworkInterfaces): Likewise.
(toString): Fix output of addresses of an interface.

From-SVN: r66500

libjava/ChangeLog
libjava/java/net/NetworkInterface.java

index 11ec7b93c88e8f327e7b4b4c5fda3b6b3242e094..7a80c51d2976f3f085e9fcd1a93218950944cb4e 100644 (file)
@@ -1,3 +1,13 @@
+2003-05-05  Michael Koch  <konqueror@gmx.de>
+
+       * java/net/NetworkInterface.java
+       (networkInterfaces): Removed.
+       (getByName): Use getRealNetworkInterfaces() instead of
+       networkInterfaces.
+       (getByInetAddress): Likewise.
+       (getNetworkInterfaces): Likewise.
+       (toString): Fix output of addresses of an interface.
+
 2003-05-05  Michael Koch  <konqueror@gmx.de>
 
        * java/io/DataInputStream.java:
index 9f8e8242963b3d32bf9daf41782b39fe6b69d7a0..4e8f4276c576c3a1604ff80a7dc68b5fe662a233 100644 (file)
@@ -46,8 +46,6 @@ import java.util.Vector;
  */
 public final class NetworkInterface
 {
-  private static Vector networkInterfaces;
-       
   private String name;
   
   private Vector inetAddresses;
@@ -125,8 +123,7 @@ public final class NetworkInterface
   public static NetworkInterface getByName (String name)
     throws SocketException
   {
-    if (networkInterfaces == null)
-      networkInterfaces = getRealNetworkInterfaces ();
+    Vector networkInterfaces = getRealNetworkInterfaces ();
 
     for (Enumeration e = networkInterfaces.elements ();
          e.hasMoreElements (); )
@@ -151,8 +148,7 @@ public final class NetworkInterface
   public static NetworkInterface getByInetAddress (InetAddress addr)
     throws SocketException
   {
-    if (networkInterfaces == null)
-      networkInterfaces = getRealNetworkInterfaces ();
+    Vector networkInterfaces = getRealNetworkInterfaces ();
     
     for (Enumeration interfaces = networkInterfaces.elements ();
          interfaces.hasMoreElements (); )
@@ -179,10 +175,10 @@ public final class NetworkInterface
   public static Enumeration getNetworkInterfaces ()
     throws SocketException
   {
-    if (networkInterfaces == null)
-      networkInterfaces = getRealNetworkInterfaces ();
+    Vector networkInterfaces = getRealNetworkInterfaces ();
 
     Enumeration tmp = networkInterfaces.elements ();
+
     if (tmp.hasMoreElements ())
       return tmp;
 
@@ -200,6 +196,7 @@ public final class NetworkInterface
       return false;
    
     NetworkInterface tmp = (NetworkInterface) obj;
+
     return (name.equals (tmp.name)
             && inetAddresses.equals (tmp.inetAddresses));
   }
@@ -229,7 +226,7 @@ public final class NetworkInterface
          e.hasMoreElements (); )
       {
         InetAddress address = (InetAddress) e.nextElement ();
-        result += address.toString () + separator;
+        result += address.toString () + ";" + separator;
       }
 
     return result;