diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-10-29 22:49:21 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-10-29 22:49:21 +0000 |
commit | e36d2a50b5a1a677c7ecaf926e73a5dac386c1ef (patch) | |
tree | 9649a7997f35624c829eccad8c84c84e9c8e3fb9 /java/net/NetworkInterface.java | |
parent | be24db70d4ff66302f560e12913f5b71acf3c12c (diff) | |
download | classpath-e36d2a50b5a1a677c7ecaf926e73a5dac386c1ef.tar.gz |
2006-10-29 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD --> generics for 2006/10/04-2006/10/29.
Diffstat (limited to 'java/net/NetworkInterface.java')
-rw-r--r-- | java/net/NetworkInterface.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/java/net/NetworkInterface.java b/java/net/NetworkInterface.java index af595a1ee..6c78ead5b 100644 --- a/java/net/NetworkInterface.java +++ b/java/net/NetworkInterface.java @@ -67,6 +67,16 @@ public final class NetworkInterface this.netif = netif; } + /** Creates an NetworkInterface instance which + * represents any interface in the system. Its only + * address is <code>0.0.0.0/0.0.0.0</code>. This + * method is needed by {@link MulticastSocket#getNetworkInterface} + */ + static NetworkInterface createAnyInterface() + { + return new NetworkInterface(new VMNetworkInterface()); + } + /** * Returns the name of the network interface * @@ -208,6 +218,9 @@ public final class NetworkInterface return false; NetworkInterface tmp = (NetworkInterface) obj; + + if (netif.name == null) + return tmp.netif.name == null; return (netif.name.equals(tmp.netif.name) && (netif.addresses.equals(tmp.netif.addresses))); @@ -221,7 +234,12 @@ public final class NetworkInterface public int hashCode() { // FIXME: hash correctly - return netif.name.hashCode() + netif.addresses.hashCode(); + int hc = netif.addresses.hashCode(); + + if (netif.name != null) + hc += netif.name.hashCode(); + + return hc; } /** |