Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8324719

Missing synchronized block in BasicDirectoryModel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P4
    • tbd
    • 8, 11, 17, 21, 22, 23
    • client-libs
    • None

    Description

      Looking at the methods of BasicDirectoryModel, I can see that some methods use synchronized(fileCache) before accessing the field but others (getSize, contains, indexOf, getElementAt), which makes the BasicDirectoryModel class not thread-safe; it is especially dangerous with contains and indexOf where the contents of the fileCache can be changed while the method is iterating over the values inside fileCache.

      These methods—getSize, contains, indexOf, getElementAt—are to access fileCache within synchronized(fileCache) {}.

      https://github.com/openjdk/jdk/pull/17462#issuecomment-1909906871

      Attachments

        Issue Links

          Activity

            People

              tr Tejesh R
              aivanov Alexey Ivanov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: