[LOG4J2-1619] new Log4jLogEvent().toString() throws an NPE.

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

Branch: refs/heads/LOG4J2-1390
Commit: e6781f5e5789fed20fc4b0cbc3edb6c30dc012c5
Parents: 10a3443
Author: Gary Gregory <[email protected]>
Authored: Wed Sep 28 16:12:13 2016 -0700
Committer: Gary Gregory <[email protected]>
Committed: Wed Sep 28 16:12:13 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java    | 2 +-
 src/changes/changes.xml                                           | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e6781f5e/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
index 291687a..4759976 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
@@ -741,7 +741,7 @@ public class Log4jLogEvent implements LogEvent {
         final String n = loggerName.isEmpty() ? LoggerConfig.ROOT : loggerName;
         sb.append("Logger=").append(n);
         sb.append(" Level=").append(level.name());
-        sb.append(" Message=").append(message.getFormattedMessage());
+        sb.append(" Message=").append(message == null ? null : 
message.getFormattedMessage());
         return sb.toString();
     }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e6781f5e/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 553f101..6c5d2cd 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -180,6 +180,9 @@
       <action issue="LOG4J2-1610" dev="ggregory" type="fix" 
due-to="Shubhankar">
         Add targetNamespace to log4j-config.xsd. GitHub #43.
       </action>
+      <action issue="LOG4J2-1619" dev="ggregory" type="fix">
+        new Log4jLogEvent().toString() throws an NPE.
+      </action>
       <action issue="LOG4J2-1578" dev="ggregory" type="add">
         RoutingAppender can be configured with scripts. Add Script in a Routes 
element.
       </action>

Reply via email to