Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 2.7.3
    • Fix Version/s: 3.0.0
    • Component/s: API
    • Labels:
      None
    • # Replies:
      3
    • Last comment by Customer:
      false

      Description

      ObjectId's equals(...) method is implemented invalidly. equals(...) methods need to be symmetrical, which means if A.equals(B) is true, B.equals(A) needs to be true as well. This is not the case as the implementation massages String values into ObjectId instances and thus surprisingly the following code succeeds:

      ObjectId left = new ObjectId();
      String right = left.toString();
       
      assertThat(left, is(right)); // succeeds

      This breaks once you test for symmetry:

      assertThat(right, is(left)); // fails

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                2 years, 33 weeks, 4 days ago
                Date of 1st Reply: