logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1201602 - /logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
Date Mon, 14 Nov 2011 05:36:42 GMT
Author: rgoers
Date: Mon Nov 14 05:36:42 2011
New Revision: 1201602

URL: http://svn.apache.org/viewvc?rev=1201602&view=rev
Log:
Fix NullPointerException

Modified:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java?rev=1201602&r1=1201601&r2=1201602&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
Mon Nov 14 05:36:42 2011
@@ -111,17 +111,21 @@ public class ThreadContextMapFilter exte
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("isAnd=").append(isAnd);
-        if (map.size() > 0) {
-            sb.append(", {");
-            boolean first = true;
-            for (Map.Entry<String, String> entry : map.entrySet()) {
-                if (!first) {
-                    sb.append(", ");
+        if (useMap) {
+            if (map.size() > 0) {
+                sb.append(", {");
+               boolean first = true;
+                for (Map.Entry<String, String> entry : map.entrySet()) {
+                    if (!first) {
+                        sb.append(", ");
+                    }
+                    first = false;
+                    sb.append(entry.getKey()).append("=").append(entry.getValue());
                 }
-                first = false;
-                sb.append(entry.getKey()).append("=").append(entry.getValue());
-            }
-            sb.append("}");
+                sb.append("}");
+          }
+        } else {
+            sb.append(", {").append(key).append("=").append(value).append("}");
         }
         return sb.toString();
     }



Mime
View raw message