Revision: 413
          http://svn.sourceforge.net/stripes/?rev=413&view=rev
Author:   tfenne
Date:     2006-09-25 18:11:36 -0700 (Mon, 25 Sep 2006)

Log Message:
-----------
Fix for STS-269: incorrect equals() implementation for SimpleError.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/validation/SimpleError.java

Modified: trunk/stripes/src/net/sourceforge/stripes/validation/SimpleError.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/validation/SimpleError.java       
2006-09-26 00:54:28 UTC (rev 412)
+++ trunk/stripes/src/net/sourceforge/stripes/validation/SimpleError.java       
2006-09-26 01:11:36 UTC (rev 413)
@@ -153,31 +153,24 @@
         return actionPath;
     }
 
-    /** Generated equals method that checks all fields for equality. */
+    /** Generated equals method that ensures the message, field, parameters 
and action path are all equal. */
     public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        if (!super.equals(o)) return false;
 
         final SimpleError that = (SimpleError) o;
 
-        if (actionPath != null ? !actionPath.equals(that.actionPath) : 
that.actionPath != null) {
-            return false;
-        }
-        if (fieldNameKey != null ? !fieldNameKey.equals(that.fieldNameKey) : 
that.fieldNameKey != null) {
-            return false;
-        }
+        if (actionPath != null ? !actionPath.equals(that.actionPath) : 
that.actionPath != null) return false;
+        if (fieldNameKey != null ? !fieldNameKey.equals(that.fieldNameKey) : 
that.fieldNameKey != null) return false;
 
         return true;
     }
 
-    /** Generated hashCode() method. */
+    /** Hashcode based on the message, field name key, action path and 
parameters. */
     public int hashCode() {
         int result = super.hashCode();
-        result = (fieldNameKey != null ? fieldNameKey.hashCode() : 0);
+        result = 29 * result + (fieldNameKey != null ? fieldNameKey.hashCode() 
: 0);
         result = 29 * result + (actionPath != null ? actionPath.hashCode() : 
0);
         return result;
     }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to