diff options
author | Michael Koch <konqueror@gmx.de> | 2004-04-29 21:16:42 +0000 |
---|---|---|
committer | Michael Koch <konqueror@gmx.de> | 2004-04-29 21:16:42 +0000 |
commit | 4f61ee51db568b5ed0e1198185e607ed744a4007 (patch) | |
tree | b11d5527f9d77742ebcd57c82bd89ee5ff175e12 | |
parent | b935cf8baca8ebbca092b373261ebe8736108c8c (diff) | |
download | classpath-4f61ee51db568b5ed0e1198185e607ed744a4007.tar.gz |
2004-04-29 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java
(static): ANY_IF should be an instance of Inet4Address.
(InetAddress): Remove unused constructors.
(getByName): Create instance of Inet4Address for IPv4 addresses.
(getAllByName): Likewise.
(getInaddrAny): Likewise.
* java/net/Inet4Address.java
(Inet4Address): New constructor which takes hostname_alias. route all
other construtors through this one.
* java/net/Inet6Address.java
(Inet6Address): Call correct super constructor.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | java/net/Inet4Address.java | 31 | ||||
-rw-r--r-- | java/net/Inet6Address.java | 2 | ||||
-rw-r--r-- | java/net/InetAddress.java | 37 |
4 files changed, 50 insertions, 34 deletions
@@ -1,5 +1,19 @@ 2004-04-29 Michael Koch <konqueror@gmx.de> + * java/net/InetAddress.java + (static): ANY_IF should be an instance of Inet4Address. + (InetAddress): Remove unused constructors. + (getByName): Create instance of Inet4Address for IPv4 addresses. + (getAllByName): Likewise. + (getInaddrAny): Likewise. + * java/net/Inet4Address.java + (Inet4Address): New constructor which takes hostname_alias. route all + other construtors through this one. + * java/net/Inet6Address.java + (Inet6Address): Call correct super constructor. + +2004-04-29 Michael Koch <konqueror@gmx.de> + * java/nio/ByteBuffer.java, java/nio/CharBuffer.java, java/nio/DoubleBuffer.java, diff --git a/java/net/Inet4Address.java b/java/net/Inet4Address.java index 0a583efc9..5b8ddc171 100644 --- a/java/net/Inet4Address.java +++ b/java/net/Inet4Address.java @@ -62,7 +62,19 @@ public final class Inet4Address extends InetAddress */ private Object writeReplace() throws ObjectStreamException { - return new InetAddress(addr, hostName); + return new InetAddress(addr, hostName, null); + } + + /** + * Initializes this object's addr instance variable from the passed in + * byte array. Note that this constructor is package-private and is called + * only by static methods in InetAddress. + * + * @param addr + */ + Inet4Address(byte[] addr) + { + this(addr, null, null); } /** @@ -73,10 +85,25 @@ public final class Inet4Address extends InetAddress */ Inet4Address(byte[] addr, String host) { - super(addr, host); + this(addr, host, null); } /** + * Initializes this object's addr instance variable from the passed in + * byte array. Note that this constructor is protected and is called + * only by static methods in this class. + * + * @param addr The IP number of this address as an array of bytes + * @param hostname The hostname of this IP address. + * @param hostname_alias A backup hostname to use if hostname is null to + * prevent reverse lookup failures + */ + Inet4Address(byte[] addr, String hostname, String hostname_alias) + { + super(addr, hostname, hostname_alias); + } + + /** * Checks if the address is a multicast address * * @since 1.1 diff --git a/java/net/Inet6Address.java b/java/net/Inet6Address.java index 5d5273599..3ae89d284 100644 --- a/java/net/Inet6Address.java +++ b/java/net/Inet6Address.java @@ -67,7 +67,7 @@ public final class Inet6Address extends InetAddress */ Inet6Address(byte[] addr, String host) { - super(addr, host); + super(addr, host, null); this.ipaddress = addr; } diff --git a/java/net/InetAddress.java b/java/net/InetAddress.java index 3e2e1f902..8bd33fcc1 100644 --- a/java/net/InetAddress.java +++ b/java/net/InetAddress.java @@ -149,7 +149,7 @@ public class InetAddress implements Serializable { // Hmmm, make one up and hope that it works. byte[] zeros = { 0, 0, 0, 0 }; - ANY_IF = new InetAddress(zeros); + ANY_IF = new Inet4Address(zeros); } } @@ -191,32 +191,7 @@ public class InetAddress implements Serializable /** * Initializes this object's addr instance variable from the passed in - * int array. Note that this constructor is protected and is called - * only by static methods in this class. - * - * @param ipaddr The IP number of this address as an array of bytes - */ - InetAddress(byte[] address) - { - this (address, null, null); - } - - /** - * Initializes this object's addr instance variable from the passed in - * int array. Note that this constructor is protected and is called - * only by static methods in this class. - * - * @param ipaddr The IP number of this address as an array of bytes - * @param hostname The hostname of this IP address. - */ - InetAddress(byte[] address, String hostname) - { - this(address, hostname, null); - } - - /** - * Initializes this object's addr instance variable from the passed in - * int array. Note that this constructor is protected and is called + * byte array. Note that this constructor is protected and is called * only by static methods in this class. * * @param ipaddr The IP number of this address as an array of bytes @@ -636,7 +611,7 @@ public class InetAddress implements Serializable // Assume that the host string is an IP address byte[] address = aton(hostname); if (address != null) - return new InetAddress(address); + return new Inet4Address(address); // Try to resolve the host by DNS InetAddress[] addresses = getAllByName(hostname); @@ -697,7 +672,7 @@ public class InetAddress implements Serializable // canonical names of these ip's when the user asks for the hostname // But do specify the host alias so if the IP returned won't // reverse lookup we don't throw an exception. - addresses[i] = new InetAddress(iplist[i], null, hostname); + addresses[i] = new Inet4Address(iplist[i], null, hostname); } addToCache(hostname, addresses); @@ -777,10 +752,10 @@ public class InetAddress implements Serializable if (inaddr_any == null) { byte[] tmp = lookupInaddrAny(); - inaddr_any = new InetAddress(tmp); + inaddr_any = new Inet4Address(tmp); } - return (inaddr_any); + return inaddr_any; } /** |