User: starksm 
  Date: 01/07/29 09:19:07

  Modified:    src/main/org/jboss/security SimplePrincipal.java
  Log:
  Update the equals method to work with Principals
  
  Revision  Changes    Path
  1.5       +10 -8     jboss/src/main/org/jboss/security/SimplePrincipal.java
  
  Index: SimplePrincipal.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/security/SimplePrincipal.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimplePrincipal.java      2001/06/18 20:01:28     1.4
  +++ SimplePrincipal.java      2001/07/29 16:19:07     1.5
  @@ -25,18 +25,20 @@
       this.name = name;
     }
   
  -  /** Compare this SimplePrincipal's name against another SimplePrincipal
  -      name or null if this.getName() is null.
  -  @return true if name == another == null || name equals
  -      another.toString();
  +  /** Compare this SimplePrincipal's name against another Principal
  +  @return true if name equals another.getName();
      */
     public boolean equals(Object another)
     {
  -    if (name == null)
  -      return (another == null);  
  -    if ((another == null) || !(another instanceof SimplePrincipal))
  +    if( !(another instanceof Principal) )
         return false;
  -    return name.equals( another.toString() );
  +    String anotherName = ((Principal)another).getName();
  +    boolean equals = false;
  +    if( name == null )
  +      equals = anotherName == null;
  +    else
  +      equals = name.equals(anotherName);
  +    return equals;
     }
   
     public int hashCode()
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to