classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: gnu.CORBA.IOR fix.


From: Meskauskas Audrius
Subject: [cp-patches] FYI: gnu.CORBA.IOR fix.
Date: Mon, 07 Nov 2005 08:45:18 +0100
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

2005-11-07  Audrius Meskauskas  <address@hidden>

* gnu/CORBA/IOR.java (equals, hasCode): Compare port number as well
and do not crash on .Internet==null.

Index: gnu/CORBA/IOR.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/CORBA/IOR.java,v
retrieving revision 1.10
diff -u -r1.10 IOR.java
--- gnu/CORBA/IOR.java  6 Nov 2005 13:26:24 -0000       1.10
+++ gnu/CORBA/IOR.java  7 Nov 2005 07:32:48 -0000
@@ -730,6 +730,10 @@
         boolean hosts = true;
 
         IOR other = (IOR) x;
+        
+        if (Internet==null || other.Internet==null)
+          return Internet == other.Internet;
+        
         if (key != null && other.key != null)
           keys = Arrays.equals(key, other.key);
         else
@@ -739,7 +743,7 @@
           if (other.Internet != null && other.Internet.host != null)
             hosts = other.Internet.host.equals(Internet.host);
 
-        return keys & hosts;
+        return keys & hosts && Internet.port==other.Internet.port;
       }
     else
       return false;
@@ -753,9 +757,12 @@
     Adler32 adler = new Adler32();
     if (key != null)
       adler.update(key);
-    if (Internet != null && Internet.host != null)
-      adler.update(Internet.host.getBytes());
-
+    if (Internet != null)
+      {
+        if (Internet.host != null)
+          adler.update(Internet.host.getBytes());
+        adler.update(Internet.port);
+      }
     return (int) adler.getValue();
   }
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]