Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3548

EndPointImpl's hasCode value should not change when its mutable properties are changed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4, 2.3.4
    • 2.4.1, 2.3.5
    • Core
    • None
    • Novice

    Description

      The current implementation of hashCode() simply calls HashMap's hashCode(). Consequently, the hashCode changes whenever some changes occur in this property table. The endpoint's hashCode should be calculated on the immutable part to avoid confusion as the following abnormality can be observed:

      Endpoint ep = ...
      map = new HashMap<...>();
      map.put(ep, "A");
      assertNotNull(map.get(ep)); // okay
      ep.put(USING_ADDRESSING, b);
      assertEquals(ep, map.keySet().iterator().next()); // okay
      assertNotNull(map.get(ep)); // error

      This issue was discussed in dev@cxf:
      http://cxf.547215.n5.nabble.com/org-apache-cxf-endpoint-EndpointImpl-may-not-be-used-as-a-hash-map-key-td4393354.html

      Attachments

        Activity

          People

            ay Akitoshi Yoshida
            ay Akitoshi Yoshida
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified