Author: nextgens
Date: 2006-08-26 21:26:41 +0000 (Sat, 26 Aug 2006)
New Revision: 10273
Modified:
trunk/freenet/src/freenet/client/ArchiveKey.java
trunk/freenet/src/freenet/keys/Key.java
trunk/freenet/src/freenet/keys/USK.java
Log:
cleanup some equals() method
Modified: trunk/freenet/src/freenet/client/ArchiveKey.java
===================================================================
--- trunk/freenet/src/freenet/client/ArchiveKey.java 2006-08-26 19:22:03 UTC
(rev 10272)
+++ trunk/freenet/src/freenet/client/ArchiveKey.java 2006-08-26 21:26:41 UTC
(rev 10273)
@@ -13,8 +13,9 @@
}
public boolean equals(Object o) {
+ if((o == null) || !(o instanceof ArchiveKey)) return false;
if(this == o) return true;
- if(!(o instanceof ArchiveKey)) return false;
+
ArchiveKey cmp = ((ArchiveKey)o);
return (cmp.key.equals(key) && cmp.filename.equals(filename));
}
Modified: trunk/freenet/src/freenet/keys/Key.java
===================================================================
--- trunk/freenet/src/freenet/keys/Key.java 2006-08-26 19:22:03 UTC (rev
10272)
+++ trunk/freenet/src/freenet/keys/Key.java 2006-08-26 21:26:41 UTC (rev
10273)
@@ -95,7 +95,7 @@
}
public boolean equals(Object o){
- if(o == null) return false;
+ if(o == null || !(o instanceof Key)) return false;
return this.hash == o.hashCode();
}
Modified: trunk/freenet/src/freenet/keys/USK.java
===================================================================
--- trunk/freenet/src/freenet/keys/USK.java 2006-08-26 19:22:03 UTC (rev
10272)
+++ trunk/freenet/src/freenet/keys/USK.java 2006-08-26 21:26:41 UTC (rev
10273)
@@ -94,6 +94,7 @@
}
public boolean equals(Object o) {
+ if(o == null || !(o instanceof USK)) return false;
return equals(o, true);
}