Author: toad
Date: 2007-05-23 23:15:51 +0000 (Wed, 23 May 2007)
New Revision: 13349

Modified:
   trunk/freenet/src/freenet/keys/Key.java
Log:
Better equals()

Modified: trunk/freenet/src/freenet/keys/Key.java
===================================================================
--- trunk/freenet/src/freenet/keys/Key.java     2007-05-23 23:08:25 UTC (rev 
13348)
+++ trunk/freenet/src/freenet/keys/Key.java     2007-05-23 23:15:51 UTC (rev 
13349)
@@ -7,6 +7,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.security.MessageDigest;
+import java.util.Arrays;

 import freenet.crypt.SHA256;
 import freenet.io.WritableToDataOutputStream;
@@ -102,7 +103,7 @@

     public boolean equals(Object o){
        if(o == null || !(o instanceof Key)) return false;
-       return this.hash == o.hashCode();
+       return Arrays.equals(routingKey, ((Key)o).routingKey);
     }

     static Bucket decompress(boolean isCompressed, byte[] output, int 
outputLength, BucketFactory bf, int maxLength, short compressionAlgorithm, 
boolean shortLength) throws CHKDecodeException, IOException {


Reply via email to