karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [1/2] karaf git commit: [KARAF-5016] Possible NPE while running "log:tail" in Karaf console
Date Tue, 07 Mar 2017 15:22:20 GMT
Repository: karaf
Updated Branches:
  refs/heads/master 38319630d -> eeb09556e


[KARAF-5016] Possible NPE while running "log:tail" in Karaf console

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

Branch: refs/heads/master
Commit: eeb09556eb6b59599ee4a8b57fbee34ea75599e4
Parents: c10cdcd
Author: Guillaume Nodet <gnodet@apache.org>
Authored: Tue Mar 7 15:39:05 2017 +0100
Committer: Guillaume Nodet <gnodet@apache.org>
Committed: Tue Mar 7 15:39:35 2017 +0100

----------------------------------------------------------------------
 .../karaf/log/core/internal/layout/PatternParser.java       | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/eeb09556/log/src/main/java/org/apache/karaf/log/core/internal/layout/PatternParser.java
----------------------------------------------------------------------
diff --git a/log/src/main/java/org/apache/karaf/log/core/internal/layout/PatternParser.java
b/log/src/main/java/org/apache/karaf/log/core/internal/layout/PatternParser.java
index 26956f4..a3abad8 100644
--- a/log/src/main/java/org/apache/karaf/log/core/internal/layout/PatternParser.java
+++ b/log/src/main/java/org/apache/karaf/log/core/internal/layout/PatternParser.java
@@ -531,9 +531,12 @@ public class PatternParser {
 
     public
     String convert(PaxLoggingEvent event) {
-        if (key == null) {
+        Map properties = event.getProperties();
+        if (properties == null) {
+          return null;
+        }
+        else if (key == null) {
             StringBuffer buf = new StringBuffer("{");
-            Map properties = event.getProperties();
             if (properties.size() > 0) {
               Object[] keys = properties.keySet().toArray();
               Arrays.sort(keys);
@@ -548,7 +551,7 @@ public class PatternParser {
             buf.append('}');
             return buf.toString();
         } else {
-          Object val = event.getProperties().get(key);
+          Object val = properties.get(key);
           if(val == null) {
               return null;
           } else {


Mime
View raw message