Skip to content

Commit

Permalink
AMBARI-24750: Fix NPE when trying to set loglevel in logsearch (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinw66 committed Oct 14, 2022
1 parent ebcda71 commit 677c4ca
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public void setLogLevelFilters(String clusterName, LogLevelFilterMap filters) th
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());
logger.info("Set log level filter for the log " + e.getKey() + " for cluster " + clusterName);
Expand Down

0 comments on commit 677c4ca

Please sign in to comment.