Log4j 2
  1. Log4j 2
  2. LOG4J2-297

Wasted work in TestConfigurator.testEnvironment

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta7
    • Fix Version/s: 2.0-beta8
    • Component/s: None
    • Labels:
    • Environment:

      any

      Description

      The problem appears in Log4j 2.0-beta7 and in revision 1498014. I
      attached a one-line patch that fixes it.

      In method "TestConfigurator.testEnvironment", the loop over
      "map.entrySet()" should break immediately after "app" is set the first
      time to "entry.getValue()". I don't think "app" is set a second time
      (and therefore all future iterations are not useful), but if it is,
      then there is a problem in the implementation: when the loop exits,
      "app" would be set to the last value of "entry.getValue()" that meets
      some condition; however "map.entrySet()" is a Set and therefore the
      order of iterating it is non-deterministic, i.e., the implementation
      should not rely on what the "last value" is.

      1. patch.diff
        0.6 kB
        Adrian Nistor

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Gary Gregory
            Reporter:
            Adrian Nistor
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development