2005-11-07 Audrius Meskauskas <[EMAIL PROTECTED]>
* 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(); } }
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches