Commons Logging
  1. Commons Logging
  2. LOGGING-146

LogFactory.nullClassLoaderFactory is not properly synchronized

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.1.2
    • Labels:
      None

      Description

      Not all accesses to the protected static mutable field LogFactory.nullClassLoaderFactory are synch. using the same lock.

      This is necessary to ensure safe publication of mutable fields.

      As far as I can tell, the field is only required because a Hashtable cannot hold a null key. So it's not clear why the field is protected rather than private.

      Also, it ought to be possible to replace the field with a dummy key object which can then be used in the Hashtable. That would simplify the code.
      However, any subclasses that relied on the field contents might break.

      If LogFactory is not intended to be part of the public API, then the field could be replaced by the dummy key approach.

        Activity

        Thomas Neidhart made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Thomas Neidhart made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.1.2 [ 12314498 ]
        Resolution Fixed [ 1 ]
        Hide
        Thomas Neidhart added a comment -

        Made field volatile and deprecated in r1435122.

        With the next major release the use of this field should be changed according to sebb's suggestions.

        Show
        Thomas Neidhart added a comment - Made field volatile and deprecated in r1435122. With the next major release the use of this field should be changed according to sebb's suggestions.
        Sebb created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Sebb
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development