java.util.ConcurrentModificationException in LogManager.getLoggerNames()

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: P3
    • 8
    • Affects Version/s: 6u14
    • Component/s: core-libs

      LogManager.loggers is a Hashtable<String,Logger> as of 1.6u14, and the getLoggerNames() method reads as follows:

          public synchronized Enumeration<String> getLoggerNames() {
              return loggers.keys();
          }

      If one thread is walking the returned Enumeration object while another thread touches the loggers field (such as by adding a new logger), a ConcurrentModificationException would result.

      One way to fix this is to create a copy within the synchronized block, such as:

         return new Vector<String>(loggers.keys()).elements();

            Assignee:
            Jim Gish (Inactive)
            Reporter:
            Kohsuke Kawaguchi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: