Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2380

ReferenceMap should not store or return null values

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.M1
    • Fix Version/s: 4.1.M2
    • Component/s: Core Library
    • Labels:
      None

      Description

      This one from dev@list:

      The problem is in ReferenceMap.values(). If the GC runs between
      checkReferenceQueue() and the last v.get(), then null can be added to the
      collection (when using the default WeakValueMap). keySet() and entrySet()
      have similar issues.

      Previously used class from commons-collections forbid null values so our implementation should do the same, this allows to clear nulls not only explicitly in reference queue check but also inside any operation.

      keySet() method will be intact as we can't make any assumption about when returned keys will be used thus it's impractical to additionally clear stale references in that method.

        Attachments

          Activity

            People

            • Assignee:
              ntimofeev Nikita Timofeev
              Reporter:
              ntimofeev Nikita Timofeev
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: