Commit 7cbd1918 by Tom Tromey Committed by Tom Tromey

Inet6Address.java (isAnyLocalAddress): Don't use "==" on arrays.

	* java/net/Inet6Address.java (isAnyLocalAddress): Don't use "=="
	on arrays.
	(isLoopbackAddress): Likewise.
	* java/net/Inet4Address.java (isAnyLocalAddress): Don't use "=="
	on arrays.

From-SVN: r68173
parent 5a9384dd
2003-06-18 Tom Tromey <tromey@redhat.com>
* java/net/Inet6Address.java (isAnyLocalAddress): Don't use "=="
on arrays.
(isLoopbackAddress): Likewise.
* java/net/Inet4Address.java (isAnyLocalAddress): Don't use "=="
on arrays.
2003-06-18 Matt Kraai <kraai@alumni.cmu.edu> 2003-06-18 Matt Kraai <kraai@alumni.cmu.edu>
* java/lang/natVMSecurityManager.cc (getClassContext): * java/lang/natVMSecurityManager.cc (getClassContext):
......
/* Inet4Address.java /* Inet4Address.java
Copyright (C) 2002 Free Software Foundation, Inc. Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -39,6 +39,7 @@ package java.net; ...@@ -39,6 +39,7 @@ package java.net;
import java.io.IOException; import java.io.IOException;
import java.io.ObjectStreamException; import java.io.ObjectStreamException;
import java.util.Arrays;
/** /**
* @author Michael Koch * @author Michael Koch
...@@ -103,7 +104,7 @@ public final class Inet4Address extends InetAddress ...@@ -103,7 +104,7 @@ public final class Inet4Address extends InetAddress
{ {
byte[] anylocal = { 0, 0, 0, 0 }; byte[] anylocal = { 0, 0, 0, 0 };
return addr == anylocal; return Arrays.equals(addr, anylocal);
} }
/** /**
......
/* Inet6Address.java /* Inet6Address.java
Copyright (C) 2002 Free Software Foundation, Inc. Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -38,6 +38,7 @@ exception statement from your version. */ ...@@ -38,6 +38,7 @@ exception statement from your version. */
package java.net; package java.net;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
/** /**
* @author Michael Koch * @author Michael Koch
...@@ -91,7 +92,7 @@ public final class Inet6Address extends InetAddress ...@@ -91,7 +92,7 @@ public final class Inet6Address extends InetAddress
byte[] anylocal = { 0, 0, 0, 0, 0, 0, 0, 0, byte[] anylocal = { 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 }; 0, 0, 0, 0, 0, 0, 0, 0 };
return ipaddress == anylocal; return Arrays.equals(ipaddress, anylocal);
} }
/** /**
...@@ -104,7 +105,7 @@ public final class Inet6Address extends InetAddress ...@@ -104,7 +105,7 @@ public final class Inet6Address extends InetAddress
byte[] loopback = { 0, 0, 0, 0, 0, 0, 0, 0, byte[] loopback = { 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1 }; 0, 0, 0, 0, 0, 0, 0, 1 };
return ipaddress == loopback; return Arrays.equals(ipaddress, loopback);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment