Index: java/net/InetAddress.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/net/InetAddress.java,v retrieving revision 1.30 diff -u -r1.30 InetAddress.java --- java/net/InetAddress.java 12 Apr 2004 11:09:19 -0000 1.30 +++ java/net/InetAddress.java 29 Apr 2004 21:14:53 -0000 @@ -149,7 +149,7 @@ { // 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 @@ /** * 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 @@ // 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 @@ // 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 @@ if (inaddr_any == null) { byte[] tmp = lookupInaddrAny(); - inaddr_any = new InetAddress(tmp); + inaddr_any = new Inet4Address(tmp); } - return (inaddr_any); + return inaddr_any; } /** Index: java/net/Inet4Address.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/net/Inet4Address.java,v retrieving revision 1.9 diff -u -r1.9 Inet4Address.java --- java/net/Inet4Address.java 8 Apr 2004 17:25:02 -0000 1.9 +++ java/net/Inet4Address.java 29 Apr 2004 21:14:53 -0000 @@ -62,7 +62,19 @@ */ 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,9 +85,24 @@ */ 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 * Index: java/net/Inet6Address.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/net/Inet6Address.java,v retrieving revision 1.6 diff -u -r1.6 Inet6Address.java --- java/net/Inet6Address.java 8 Apr 2004 17:25:02 -0000 1.6 +++ java/net/Inet6Address.java 29 Apr 2004 21:14:53 -0000 @@ -67,7 +67,7 @@ */ Inet6Address(byte[] addr, String host) { - super(addr, host); + super(addr, host, null); this.ipaddress = addr; }