You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2004/12/22 22:34:05 UTC

cvs commit: db-ojb/src/java/org/apache/ojb/broker PBKey.java

arminw      2004/12/22 13:34:05

  Modified:    src/java/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        PBKey.java
  Log:
  fix equals bug
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.11.2.2  +8 -4      db-ojb/src/java/org/apache/ojb/broker/PBKey.java
  
  Index: PBKey.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/PBKey.java,v
  retrieving revision 1.11.2.1
  retrieving revision 1.11.2.2
  diff -u -r1.11.2.1 -r1.11.2.2
  --- PBKey.java	9 Aug 2004 07:51:26 -0000	1.11.2.1
  +++ PBKey.java	22 Dec 2004 21:34:05 -0000	1.11.2.2
  @@ -65,8 +65,10 @@
           {
               return false;
           }
  -
  -        return this.hashCode() == obj.hashCode();
  +        PBKey other = (PBKey) obj;
  +        return this.jcdAlias.equals(other.getAlias())
  +                && (user != null ? user.equals(other.user) : null == other.user)
  +                && (password != null ? password.equals(other.password) : null == other.password);
       }
   
       /**
  @@ -85,7 +87,9 @@
       {
           if(hashCode == 0)
           {
  -            hashCode = (this.jcdAlias + this.user + this.password).hashCode(); 
  +            hashCode = jcdAlias.hashCode()
  +                    + (user != null ? user.hashCode() : 0)
  +                    + (password != null ? password.hashCode() : 0);
           }
           return hashCode;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org