Skip to content

Commit

Permalink
TRUNK-3407 ConceptDescription equals method fails with 2 different in…
Browse files Browse the repository at this point in the history
…stances of ConceptDescription in 1.8 and earlier
  • Loading branch information
rkorytkowski committed Jun 18, 2013
1 parent aec1701 commit bde0115
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/api/org/openmrs/ConceptDescription.java
Expand Up @@ -77,21 +77,23 @@ public ConceptDescription(String description, Locale locale) {
* @should not return true with different objects and null ids
* @should default to object equality
*/
public boolean equals(Object object) {
@Override
public boolean equals(Object object) {
if (!(object instanceof ConceptDescription)) {
return false;
}
ConceptDescription rhs = (ConceptDescription) object;
if (conceptDescriptionId != null && rhs.conceptDescriptionId != null)
return this.conceptDescriptionId == rhs.conceptDescriptionId;
return this.conceptDescriptionId.equals(rhs.conceptDescriptionId);
else
return this == object;
}

/**
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
@Override
public int hashCode() {
if (this.getConceptDescriptionId() == null)
return super.hashCode();
int hash = 8;
Expand Down Expand Up @@ -225,7 +227,8 @@ public void setDateChanged(Date dateChanged) {
/**
* @see java.lang.Object#toString()
*/
public String toString() {
@Override
public String toString() {
return this.description;
}

Expand Down

0 comments on commit bde0115

Please sign in to comment.