Author: coheigea
Date: Thu Feb 17 16:56:26 2011
New Revision: 1071694

URL: http://svn.apache.org/viewvc?rev=1071694&view=rev
Log:
Updated U/T Principal's equals and hashcode methods to reflect all of the 
fields.

Modified:
    
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSUsernameTokenPrincipal.java

Modified: 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSUsernameTokenPrincipal.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSUsernameTokenPrincipal.java?rev=1071694&r1=1071693&r2=1071694&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSUsernameTokenPrincipal.java
 (original)
+++ 
webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSUsernameTokenPrincipal.java
 Thu Feb 17 16:56:26 2011
@@ -169,6 +169,7 @@ public class WSUsernameTokenPrincipal im
      * @return true if the specified Object is equal equal to this
      *         <code>WSUsernameTokenPrincipal</code>.
      */
+    @Override
     public boolean equals(Object o) {
         if (o == null) {
             return false;
@@ -180,10 +181,27 @@ public class WSUsernameTokenPrincipal im
             return false;
         }
         WSUsernameTokenPrincipal that = (WSUsernameTokenPrincipal) o;
-        if (this.getName().equals(that.getName())) {
-            return true;
+        if (this.digest != that.digest) {
+            return false;
+        }
+        if (this.name == null ? that.name != null : 
!this.name.equals(that.name)) {
+            return false;
+        }
+        if (this.nonce == null ? that.nonce != null : 
!this.nonce.equals(that.nonce)) {
+            return false;
+        }
+        if (this.password == null ? that.password != null : 
!this.password.equals(that.password)) {
+            return false;
+        }
+        if (this.createdTime == null ? that.createdTime != null 
+            : !this.createdTime.equals(that.createdTime)) {
+            return false;
+        }
+        if (this.passwordType == null ? that.passwordType != null 
+            : !this.passwordType.equals(that.passwordType)) {
+            return false;
         }
-        return false;
+        return true;
     }
 
     /**
@@ -191,8 +209,17 @@ public class WSUsernameTokenPrincipal im
      *
      * @return a hash code for this <code>WSUsernameTokenPrincipal</code>.
      */
+    @Override
     public int hashCode() {
-        return this.hashCode();
+        int hashcode = 17;
+        hashcode = 31 * hashcode + (digest ? 1 : 0);
+        hashcode = 31 * hashcode + (name == null ? 0 : name.hashCode());
+        hashcode = 31 * hashcode + (nonce == null ? 0 : nonce.hashCode());
+        hashcode = 31 * hashcode + (password == null ? 0 : 
password.hashCode());
+        hashcode = 31 * hashcode + (createdTime == null ? 0 : 
createdTime.hashCode());
+        hashcode = 31 * hashcode + (passwordType == null ? 0 : 
passwordType.hashCode());
+        
+        return hashcode;
     }
     
 }


Reply via email to