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 2018/10/18 00:50:02 UTC

logging-log4j2 git commit: Protect test tearDown from NPEs in the event there are problems in the tests.

Repository: logging-log4j2
Updated Branches:
  refs/heads/release-2.x c88601659 -> 4345f352e


Protect test tearDown from NPEs in the event there are problems in the
tests.

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

Branch: refs/heads/release-2.x
Commit: 4345f352e92d59bae83f0efe48be4c9af3adde43
Parents: c886016
Author: Gary Gregory <gg...@rocketsoftware.com>
Authored: Wed Oct 17 18:49:59 2018 -0600
Committer: Gary Gregory <gg...@rocketsoftware.com>
Committed: Wed Oct 17 18:49:59 2018 -0600

----------------------------------------------------------------------
 .../log4j/core/appender/rewrite/RewriteAppenderTest.java     | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4345f352/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
index fb87ad9..73082e9 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
@@ -55,8 +55,12 @@ public class RewriteAppenderTest {
 
     @After
     public void tearDown() throws Exception {
-        app.clear();
-        app2.clear();
+        if (app != null) {
+            app.clear();
+        }
+        if (app2 != null) {
+            app2.clear();
+        }
     }
 
     @Test