[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: InetAddress fixes
Kaffe CVS
cvs-commits at kaffe.org
Thu Jan 6 19:03:38 PST 2005
PatchSet 5803
Date: 2005/01/07 01:38:09
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Resynced with GNU Classpath: InetAddress fixes
Members:
ChangeLog:1.3347->1.3348
libraries/javalib/java/net/Inet4Address.java:1.8->1.9
libraries/javalib/java/net/InetAddress.java:1.27->1.28
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3347 kaffe/ChangeLog:1.3348
--- kaffe/ChangeLog:1.3347 Fri Jan 7 00:47:48 2005
+++ kaffe/ChangeLog Fri Jan 7 01:38:09 2005
@@ -2,6 +2,29 @@
Resynced with GNU Classpath.
+ 2005-01-03 Michael Koch <konqueror at gmx.de>
+
+ * java/net/InetAddress.java: Made all hexadecimal numbers lowercase.
+ Fixed typos in javadocs.
+ (isSiteLocalAddress): Fixed handling of byte values.
+ (isMCLinkLocal): Likewise.
+ * java/net/Inet4Address.java
+ (isMulticastAddress): Call super method.
+ (isLoopbackAddress): Likewise.
+ (isAnyLocalAddress): Likewise.
+ (isLinkLocalAddress): Likewise.
+ (isSiteLocalAddress): Likewise.
+ (isMCGlobal): Likewise.
+ (isMCNodeLocal): Likewise.
+ (isMCLinkLocal): Likewise.
+ (isMCSiteLocal): Likewise.
+ (isMCOrgLocal): Likewise.
+ (getHostAddress): Likewise.
+
+2005-01-06 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
+
2005-01-02 Mark Wielaard <mark at klomp.org>
* gnu/java/beans/decoder/DummyHandler.java: Add return statements for
Index: kaffe/libraries/javalib/java/net/Inet4Address.java
diff -u kaffe/libraries/javalib/java/net/Inet4Address.java:1.8 kaffe/libraries/javalib/java/net/Inet4Address.java:1.9
--- kaffe/libraries/javalib/java/net/Inet4Address.java:1.8 Fri Oct 15 19:00:30 2004
+++ kaffe/libraries/javalib/java/net/Inet4Address.java Fri Jan 7 01:38:12 2005
@@ -85,7 +85,7 @@
*/
public boolean isMulticastAddress()
{
- return (addr[0] & 0xF0) == 0xE0;
+ return super.isMulticastAddress();
}
/**
@@ -93,7 +93,7 @@
*/
public boolean isLoopbackAddress()
{
- return addr[0] == 0x7F;
+ return super.isLoopbackAddress();
}
/**
@@ -103,9 +103,7 @@
*/
public boolean isAnyLocalAddress()
{
- byte[] anylocal = { 0, 0, 0, 0 };
-
- return Arrays.equals(addr, anylocal);
+ return super.isAnyLocalAddress();
}
/**
@@ -115,8 +113,7 @@
*/
public boolean isLinkLocalAddress()
{
- // XXX: This seems to not exist with IPv4 addresses
- return false;
+ return super.isLinkLocalAddress();
}
/**
@@ -126,23 +123,7 @@
*/
public boolean isSiteLocalAddress()
{
- // 10.0.0.0/8
- if (addr[0] == 0x0A)
- return true;
-
- // XXX: Suns JDK 1.4.1 (on Linux) seems to have a bug here:
- // it says 172.16.0.0 - 172.255.255.255 are site local addresses
- //
- // 172.16.0.0/12
- if (addr[0] == 0xAC && (addr[1] & 0xF0) == 0x01)
- return true;
-
- // 192.168.0.0/16
- if (addr[0] == 0xC0 && addr[1] == 0xA8)
- return true;
-
- // XXX: Do we need to check more addresses here ?
- return false;
+ return super.isSiteLocalAddress();
}
/**
@@ -152,8 +133,7 @@
*/
public boolean isMCGlobal()
{
- // XXX: This seems to net exist with IPv4 addresses
- return false;
+ return super.isMCGlobal();
}
/**
@@ -163,8 +143,7 @@
*/
public boolean isMCNodeLocal()
{
- // XXX: This seems to net exist with IPv4 addresses
- return false;
+ return isMCNodeLocal();
}
/**
@@ -174,10 +153,7 @@
*/
public boolean isMCLinkLocal()
{
- if (! isMulticastAddress())
- return false;
-
- return (addr[0] == 0xE0) && (addr[1] == 0x00) && (addr[2] == 0x00);
+ return super.isMCLinkLocal();
}
/**
@@ -187,8 +163,7 @@
*/
public boolean isMCSiteLocal()
{
- // XXX: This seems to net exist with IPv4 addresses
- return false;
+ return super.isMCSiteLocal();
}
/**
@@ -198,8 +173,7 @@
*/
public boolean isMCOrgLocal()
{
- // XXX: This seems to net exist with IPv4 addresses
- return false;
+ return isMCOrgLocal();
}
/**
@@ -217,22 +191,7 @@
*/
public String getHostAddress()
{
- StringBuffer sbuf = new StringBuffer(40);
- int len = addr.length;
- int i = 0;
-
- for (;;)
- {
- sbuf.append(addr[i] & 0xFF);
- i++;
-
- if (i == len)
- break;
-
- sbuf.append('.');
- }
-
- return sbuf.toString();
+ return super.getHostAddress();
}
/**
@@ -272,4 +231,4 @@
return true;
}
-} // class Inet4Address
+}
Index: kaffe/libraries/javalib/java/net/InetAddress.java
diff -u kaffe/libraries/javalib/java/net/InetAddress.java:1.27 kaffe/libraries/javalib/java/net/InetAddress.java:1.28
--- kaffe/libraries/javalib/java/net/InetAddress.java:1.27 Thu Nov 25 04:30:16 2004
+++ kaffe/libraries/javalib/java/net/InetAddress.java Fri Jan 7 01:38:12 2005
@@ -258,7 +258,7 @@
{
// Mask against high order bits of 1110
if (addr.length == 4)
- return (addr[0] & 0xF0) == 0xE0;
+ return (addr[0] & 0xf0) == 0xe0;
return false;
}
@@ -284,7 +284,7 @@
{
// This is the IPv4 implementation.
// Any class derived from InetAddress should override this.
- return addr[0] == 0x7F;
+ return (addr[0] & 0xff) == 0x7f;
}
/**
@@ -309,18 +309,17 @@
{
// This is the IPv4 implementation.
// Any class derived from InetAddress should override this.
+
// 10.0.0.0/8
- if (addr[0] == 0x0A)
+ if ((addr[0] & 0xff) == 0x0a)
return true;
- // XXX: Suns JDK 1.4.1 (on Linux) seems to have a bug here:
- // it says 172.16.0.0 - 172.255.255.255 are site local addresses
// 172.16.0.0/12
- if (addr[0] == 0xAC && (addr[1] & 0xF0) == 0x01)
+ if ((addr[0] & 0xff) == 0xac && (addr[1] & 0xf0) == 0x10)
return true;
// 192.168.0.0/16
- if (addr[0] == 0xC0 && addr[1] == 0xA8)
+ if ((addr[0] & 0xff) == 0xc0 && (addr[1] & 0xff) == 0xa8)
return true;
// XXX: Do we need to check more addresses here ?
@@ -341,7 +340,7 @@
}
/**
- * Utility reoutine to check if InetAddress is a node local multicast address
+ * Utility routine to check if InetAddress is a node local multicast address.
*
* @since 1.4
*/
@@ -354,7 +353,7 @@
}
/**
- * Utility reoutine to check if InetAddress is a link local multicast address
+ * Utility routine to check if InetAddress is a link local multicast address.
*
* @since 1.4
*/
@@ -365,11 +364,13 @@
if (! isMulticastAddress())
return false;
- return (addr[0] == 0xE0 && addr[1] == 0x00 && addr[2] == 0x00);
+ return ((addr[0] & 0xff) == 0xe0
+ && (addr[1] & 0xff) == 0x00
+ && (addr[2] & 0xff) == 0x00);
}
/**
- * Utility routine to check if InetAddress is a site local multicast address
+ * Utility routine to check if InetAddress is a site local multicast address.
*
* @since 1.4
*/
@@ -382,8 +383,8 @@
}
/**
- * Utility reoutine to check if InetAddress is a organization local
- * multicast address
+ * Utility routine to check if InetAddress is a organization local
+ * multicast address.
*
* @since 1.4
*/
@@ -505,7 +506,7 @@
int i = len > 4 ? len - 4 : 0;
for (; i < len; i++)
- hash = (hash << 8) | (addr[i] & 0xFF);
+ hash = (hash << 8) | (addr[i] & 0xff);
return hash;
}
@@ -867,7 +868,7 @@
int i = len - 4;
for (; i < len; i++)
- address = address << 8 | (((int) addr[i]) & 0xFF);
+ address = address << 8 | (addr[i] & 0xff);
oos.defaultWriteObject();
}
More information about the kaffe
mailing list