harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r825888 - /harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/PrivateCredentialPermission.java
Date Fri, 16 Oct 2009 13:36:23 GMT
Author: odeakin
Date: Fri Oct 16 13:36:22 2009
New Revision: 825888

URL: http://svn.apache.org/viewvc?rev=825888&view=rev
Log:
Improve PrivateCredentialPermission.equals() method as suggested by Jesse (http://harmony.markmail.org/message/ljk2nabp42jzrat4?page=30)

Modified:
    harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/PrivateCredentialPermission.java

Modified: harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/PrivateCredentialPermission.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/PrivateCredentialPermission.java?rev=825888&r1=825887&r2=825888&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/PrivateCredentialPermission.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/PrivateCredentialPermission.java
Fri Oct 16 13:36:22 2009
@@ -375,11 +375,15 @@
         // Checks two CredOwner objects for equality. 
         @Override
         public boolean equals(Object obj) {
-            if (obj == null) {
-                return false;
+            if (obj == this) {
+                return true;
             }
-            return principalClass.equals(((CredOwner) obj).principalClass)
-                    && principalName.equals(((CredOwner) obj).principalName);
+            if (obj instanceof CredOwner) {
+                CredOwner that = (CredOwner) obj;
+                return principalClass.equals(that.principalClass)
+                    && principalName.equals(that.principalName);
+            }
+            return false;
         }
 
         // Returns the hash code value for this object.



Mime
View raw message