[jboss-dev-forums] [Design of Security on JBoss] - Re: SimplePrincipal - equals() Implementation

darran.lofthouse@jboss.com do-not-reply at jboss.com
Thu Aug 23 16:19:16 EDT 2007


But it fails the following two requirements for an equals implementation: -

anonymous wrote : 
  | # It is symmetric: for any non-null reference values x and y, x.equals(y)  should return true if and only if y.equals(x) returns true.
  | # It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true. 
  | 

The following requirement from hashCode will also not be met: -

anonymous wrote : If two objects are equal according to the equals(Object)  method, then calling the hashCode method on each of the two objects must produce the same integer result.

Basically you can not put different principal implementation in a HashMap and expect consistent behaviour.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077526#4077526

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077526



More information about the jboss-dev-forums mailing list