logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1490150 - /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java
Date Thu, 06 Jun 2013 05:32:27 GMT
Author: ggregory
Date: Thu Jun  6 05:32:27 2013
New Revision: 1490150

URL: http://svn.apache.org/r1490150
Log:
Avoid possible NPE when id is null.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java?rev=1490150&r1=1490149&r2=1490150&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java
Thu Jun  6 05:32:27 2013
@@ -385,12 +385,12 @@ public final class RFC5424Layout extends
 
     private String getId(final StructuredDataId id) {
         final StringBuilder sb = new StringBuilder();
-        if (id.getName() == null) {
+        if (id == null || id.getName() == null) {
             sb.append(defaultId);
         } else {
             sb.append(id.getName());
         }
-        int ein = id.getEnterpriseNumber();
+        int ein = id != null ? id.getEnterpriseNumber() : enterpriseNumber;
         if (ein < 0) {
             ein = enterpriseNumber;
         }



Mime
View raw message