diff options
author | Michael Koch <konqueror@gmx.de> | 2003-05-05 20:18:31 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-05-05 20:18:31 +0000 |
commit | e5f3cd6b647a78dedc9febf193651f6498939f79 (patch) | |
tree | 20e2588195ba45f0ac8baa4ac0148fc7b1d934d6 /libjava/java/net | |
parent | bc9ec0e06b4e074b2a5c75c21f8f7eefbdb88c8f (diff) | |
download | gcc-e5f3cd6b647a78dedc9febf193651f6498939f79.zip gcc-e5f3cd6b647a78dedc9febf193651f6498939f79.tar.gz gcc-e5f3cd6b647a78dedc9febf193651f6498939f79.tar.bz2 |
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.
From-SVN: r66500
Diffstat (limited to 'libjava/java/net')
-rw-r--r-- | libjava/java/net/NetworkInterface.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libjava/java/net/NetworkInterface.java b/libjava/java/net/NetworkInterface.java index 9f8e824..4e8f427 100644 --- a/libjava/java/net/NetworkInterface.java +++ b/libjava/java/net/NetworkInterface.java @@ -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; |