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

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        2d 9h 24m 1 Gary Gregory 02/Jul/13 06:20
        Gary Gregory made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Gary Gregory [ garydgregory ]
        Fix Version/s 2.0-beta8 [ 12324575 ]
        Resolution Fixed [ 1 ]
        Hide
        Gary Gregory added a comment -

        Thank you for taking the time to provide a patch. I appreciate your contribution.

        commit -m "[LOG4J2-297]  Wasted work in TestConfigurator.testEnvironment." C:/vcs/svn/apache/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml
            Sending        C:/vcs/svn/apache/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
            Sending        C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml
            Transmitting file data ...
            Committed revision 1498782.
        
        Show
        Gary Gregory added a comment - Thank you for taking the time to provide a patch. I appreciate your contribution. commit -m "[LOG4J2-297] Wasted work in TestConfigurator.testEnvironment." C:/vcs/svn/apache/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml Sending C:/vcs/svn/apache/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java Sending C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml Transmitting file data ... Committed revision 1498782.
        Adrian Nistor made changes -
        Field Original Value New Value
        Attachment patch.diff [ 12590174 ]
        Adrian Nistor created 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