[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Patch: compare strings with equals()
From: |
Anthony Green |
Subject: |
[cp-patches] Patch: compare strings with equals() |
Date: |
Wed, 14 Sep 2005 17:46:46 -0700 |
'==' on Strings only works when we expect the strings to be interned,
which isn't the case here. Ok?
AG
2005-09-14 Anthony Green <address@hidden>
* java/security/Identity.java (equals, identityEquals): Don't use
`==' to compare uninterned Strings. Use String.equals().
Index: java/security/Identity.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/Identity.java,v
retrieving revision 1.10
diff -u -r1.10 Identity.java
--- java/security/Identity.java 2 Jul 2005 20:32:40 -0000 1.10
+++ java/security/Identity.java 14 Sep 2005 23:54:58 -0000
@@ -297,8 +297,8 @@
if (identity == this)
return true;
- if ((((Identity) identity).getName() == this.name) &&
- (((Identity) identity).getScope() == this.scope))
+ if ((((Identity) identity).getName().equals(this.name)) &&
+ (((Identity) identity).getScope().equals(this.scope)))
return true;
return identityEquals((Identity) identity);
@@ -319,8 +319,8 @@
*/
protected boolean identityEquals(Identity identity)
{
- return ((identity.getName() == this.name) &&
- (identity.getPublicKey() == this.publicKey));
+ return ((identity.getName().equals(this.name)) &&
+ (identity.getPublicKey().equals(this.publicKey)));
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] Patch: compare strings with equals(),
Anthony Green <=