You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2016/04/26 07:48:24 UTC

[14/38] logging-log4j2 git commit: LOG4J2-1342 bugfix: don't set ReusableParameterizedMessage array to null

LOG4J2-1342 bugfix: don't set ReusableParameterizedMessage array to null


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

Branch: refs/heads/master
Commit: fb5e7305796d18d7a69ec2ce1a76ad6ae793e77c
Parents: 79e51b2
Author: rpopma <rp...@apache.org>
Authored: Fri Apr 22 12:50:28 2016 +0900
Committer: Ralph Goers <rg...@nextiva.com>
Committed: Mon Apr 25 21:30:28 2016 -0700

----------------------------------------------------------------------
 .../apache/logging/log4j/core/async/RingBufferLogEvent.java    | 6 ++++--
 .../org/apache/logging/log4j/core/impl/MutableLogEvent.java    | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb5e7305/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
index 72ae8ac..ab5e3d0 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
@@ -115,8 +115,10 @@ public class RingBufferLogEvent implements LogEvent, ReusableMessage, CharSequen
         if (msg instanceof ReusableMessage) {
             ReusableMessage reusable = (ReusableMessage) msg;
             reusable.formatTo(getMessageTextForWriting());
-            parameters = reusable.swapParameters(parameters);
-            parameterCount = reusable.getParameterCount();
+            if (parameters != null) {
+                parameters = reusable.swapParameters(parameters);
+                parameterCount = reusable.getParameterCount();
+            }
         } else {
             // if the Message instance is reused, there is no point in freezing its message here
             if (!Constants.FORMAT_MESSAGES_IN_BACKGROUND && msg != null) { // LOG4J2-898: user may choose

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb5e7305/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/MutableLogEvent.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/MutableLogEvent.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/MutableLogEvent.java
index 0393b0c..e256723 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/MutableLogEvent.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/MutableLogEvent.java
@@ -188,8 +188,10 @@ public class MutableLogEvent implements LogEvent, ReusableMessage {
         if (msg instanceof ReusableMessage) {
             ReusableMessage reusable = (ReusableMessage) msg;
             reusable.formatTo(getMessageTextForWriting());
-            parameters = reusable.swapParameters(parameters);
-            parameterCount = reusable.getParameterCount();
+            if (parameters != null) {
+                parameters = reusable.swapParameters(parameters);
+                parameterCount = reusable.getParameterCount();
+            }
         } else {
             // if the Message instance is reused, there is no point in freezing its message here
             if (!Constants.FORMAT_MESSAGES_IN_BACKGROUND && msg != null) { // LOG4J2-898: user may choose