+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:
*/
public final class NetworkInterface
{
- private static Vector networkInterfaces;
-
private String name;
private Vector inetAddresses;
public static NetworkInterface getByName (String name)
throws SocketException
{
- if (networkInterfaces == null)
- networkInterfaces = getRealNetworkInterfaces ();
+ Vector networkInterfaces = getRealNetworkInterfaces ();
for (Enumeration e = networkInterfaces.elements ();
e.hasMoreElements (); )
public static NetworkInterface getByInetAddress (InetAddress addr)
throws SocketException
{
- if (networkInterfaces == null)
- networkInterfaces = getRealNetworkInterfaces ();
+ Vector networkInterfaces = getRealNetworkInterfaces ();
for (Enumeration interfaces = networkInterfaces.elements ();
interfaces.hasMoreElements (); )
public static Enumeration getNetworkInterfaces ()
throws SocketException
{
- if (networkInterfaces == null)
- networkInterfaces = getRealNetworkInterfaces ();
+ Vector networkInterfaces = getRealNetworkInterfaces ();
Enumeration tmp = networkInterfaces.elements ();
+
if (tmp.hasMoreElements ())
return tmp;
return false;
NetworkInterface tmp = (NetworkInterface) obj;
+
return (name.equals (tmp.name)
&& inetAddresses.equals (tmp.inetAddresses));
}
e.hasMoreElements (); )
{
InetAddress address = (InetAddress) e.nextElement ();
- result += address.toString () + separator;
+ result += address.toString () + ";" + separator;
}
return result;