Uploaded image for project: 'James Mailbox'
  1. James Mailbox
  2. MAILBOX-43

Review if equals or == should be used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.2
    • 0.2
    • None
    • None
    • all

    Description

      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;
      }

      Attachments

        Activity

          People

            norman Norman Maurer
            felixk Felix Knecht
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: