Review if equals or == should be used
-------------------------------------
Key: MAILBOX-43
URL: https://issues.apache.org/jira/browse/MAILBOX-43
Project: James Mailbox
Issue Type: Bug
Affects Versions: 0.2
Environment: all
Reporter: Felix Knecht
Assignee: Norman Maurer
Is it really correct to compare references and not values in following places?
Note that this are mostly either String or Long or Integer.
I'm sure there are more. I guess that all these kinds of 'equals' should not
compare reference but value.
e.g. JCRHeader.java, compares references instead values.
...
private String fieldName;
private String value;
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final JCRHeader other = (JCRHeader) obj;
if (getValue() != other.getValue() || getFieldName() !=
other.getFieldName())
return false;
return true;
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]