You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2017/08/14 19:44:18 UTC

logging-log4j2 git commit: Allow for empty rule chains.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master c2818beca -> 03a5e071b


Allow for empty rule chains.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/03a5e071
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/03a5e071
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/03a5e071

Branch: refs/heads/master
Commit: 03a5e071bc66f0d8e771e5dbe1453b4eb6821bbb
Parents: c2818be
Author: Gary Gregory <ga...@gmail.com>
Authored: Mon Aug 14 13:44:09 2017 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Mon Aug 14 13:44:09 2017 -0600

----------------------------------------------------------------------
 .../org/apache/logging/log4j/test/RuleChainFactory.java     | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/03a5e071/log4j-core/src/test/java/org/apache/logging/log4j/test/RuleChainFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/test/RuleChainFactory.java b/log4j-core/src/test/java/org/apache/logging/log4j/test/RuleChainFactory.java
index 6f601df..30629b2 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/test/RuleChainFactory.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/test/RuleChainFactory.java
@@ -33,11 +33,12 @@ public class RuleChainFactory {
      * @return a new rule chain.
      */
     public static RuleChain create(final TestRule... testRules) {
+        if (testRules == null || testRules.length == 0) {
+            return RuleChain.emptyRuleChain();
+        }
         RuleChain ruleChain = RuleChain.outerRule(testRules[0]);
-        for (int idx = 1; idx < testRules.length; idx++) {
-            if (ruleChain != null) {
-                ruleChain = ruleChain.around(testRules[idx]);
-            }
+        for (int i = 1; i < testRules.length; i++) {
+            ruleChain = ruleChain.around(testRules[i]);
         }
         return ruleChain;
     }