This is an automated email from the ASF dual-hosted git repository.

oleewere pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 2e14a0d  AMBARI-24750 NPE when trying to set loglevel in logsearch 
(#2432)
2e14a0d is described below

commit 2e14a0ddf46c682e58c86bd5cc911abde20f4307
Author: Peter Gergő Barna <bpge...@gmail.com>
AuthorDate: Wed Oct 10 10:07:39 2018 +0200

    AMBARI-24750 NPE when trying to set loglevel in logsearch (#2432)
---
 .../ambari/logsearch/config/zookeeper/LogLevelFilterManagerZK.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogLevelFilterManagerZK.java
 
b/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogLevelFilterManagerZK.java
index e62ec1b..efba70c 100644
--- 
a/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogLevelFilterManagerZK.java
+++ 
b/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogLevelFilterManagerZK.java
@@ -83,7 +83,8 @@ public class LogLevelFilterManagerZK implements 
LogLevelFilterManager {
     for (Map.Entry<String, LogLevelFilter> e : filters.getFilter().entrySet()) 
{
       String nodePath = String.format("/%s/loglevelfilter/%s", clusterName, 
e.getKey());
       String logLevelFilterJson = gson.toJson(e.getValue());
-      String currentLogLevelFilterJson = new 
String(serverCache.getCurrentData(nodePath).getData());
+      ChildData childData = serverCache.getCurrentData(nodePath);
+      String currentLogLevelFilterJson = childData != null ? new 
String(childData.getData()) : null;
       if (!logLevelFilterJson.equals(currentLogLevelFilterJson)) {
         client.setData().forPath(nodePath, logLevelFilterJson.getBytes());
         LOG.info("Set log level filter for the log " + e.getKey() + " for 
cluster " + clusterName);

Reply via email to