Lucene - Core
  1. Lucene - Core
  2. LUCENE-828

Term's equals() throws ClassCastException if passed something other than a Term

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      Term.equals(Object) does a cast to Term without checking if the other object is a Term.

      It's unlikely that this would ever crop up but it violates the implied contract of Object.equals().

        Activity

        Hide
        Otis Gospodnetic added a comment -

        Patch applied, thanks Paul!

        Show
        Otis Gospodnetic added a comment - Patch applied, thanks Paul!
        Hide
        Paul Cowan added a comment -

        Amendment to .equals() to deal with non-Term objects.

        Also includes standard performance optimisation in the case that the two objects are identity-equal, and a test case (the last assertion of which fails on current trunk, but passes after patch is applies to Term).

        Show
        Paul Cowan added a comment - Amendment to .equals() to deal with non-Term objects. Also includes standard performance optimisation in the case that the two objects are identity-equal, and a test case (the last assertion of which fails on current trunk, but passes after patch is applies to Term).

          People

          • Assignee:
            Unassigned
            Reporter:
            Paul Cowan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development