OSDN Git Service

* java/net/Inet6Address.java (isAnyLocalAddress): Don't use "=="
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Jun 2003 01:19:27 +0000 (01:19 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Jun 2003 01:19:27 +0000 (01:19 +0000)
on arrays.
(isLoopbackAddress): Likewise.
* java/net/Inet4Address.java (isAnyLocalAddress): Don't use "=="
on arrays.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68173 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/net/Inet4Address.java
libjava/java/net/Inet6Address.java

index 391a023..fc1b286 100644 (file)
@@ -1,3 +1,11 @@
+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>
 
        * java/lang/natVMSecurityManager.cc (getClassContext):
index c635c67..d2892fe 100644 (file)
@@ -1,5 +1,5 @@
 /* Inet4Address.java
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,6 +39,7 @@ package java.net;
 
 import java.io.IOException;
 import java.io.ObjectStreamException;
+import java.util.Arrays;
 
 /**
  * @author Michael Koch
@@ -103,7 +104,7 @@ public final class Inet4Address extends InetAddress
   {
     byte[] anylocal = { 0, 0, 0, 0 };
     
-    return addr == anylocal;
+    return Arrays.equals(addr, anylocal);
   }
 
   /**
index 8d3c0c3..ee6e666 100644 (file)
@@ -1,5 +1,5 @@
 /* Inet6Address.java
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,6 +38,7 @@ exception statement from your version. */
 package java.net;
 
 import java.io.IOException;
+import java.util.Arrays;
 
 /**
  * @author Michael Koch
@@ -91,7 +92,7 @@ public final class Inet6Address extends InetAddress
     byte[] anylocal = { 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
     byte[] loopback = { 0, 0, 0, 0, 0, 0, 0, 0,
                        0, 0, 0, 0, 0, 0, 0, 1 };
     
-    return ipaddress == loopback;
+    return Arrays.equals(ipaddress, loopback);
   }
 
   /**