You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by dc...@apache.org on 2022/05/04 16:35:35 UTC

[cassandra] branch cassandra-4.1 updated: nodetool enablefullquerylog can NPE when directory has no files

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

dcapwell pushed a commit to branch cassandra-4.1
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-4.1 by this push:
     new 559b17f71d nodetool enablefullquerylog can NPE when directory has no files
559b17f71d is described below

commit 559b17f71d3207158d34b1dd2414a531e362af20
Author: David Capwell <dc...@apache.org>
AuthorDate: Tue May 3 14:59:55 2022 -0700

    nodetool enablefullquerylog can NPE when directory has no files
    
    patch by David Capwell; reviewed by Jon Meredith for CASSANDRA-17595
---
 CHANGES.txt                                            | 1 +
 src/java/org/apache/cassandra/utils/binlog/BinLog.java | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 050767a943..131b0c980d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.1
+ * nodetool enablefullquerylog can NPE when directory has no files (CASSANDRA-17595)
  * Add auto_snapshot_ttl configuration (CASSANDRA-16790)
  * List snapshots of dropped tables (CASSANDRA-16843)
  * Add information whether sstables are dropped to SchemaChangeListener (CASSANDRA-17582)
diff --git a/src/java/org/apache/cassandra/utils/binlog/BinLog.java b/src/java/org/apache/cassandra/utils/binlog/BinLog.java
index a9bb55ac8d..e2ae1ec09b 100644
--- a/src/java/org/apache/cassandra/utils/binlog/BinLog.java
+++ b/src/java/org/apache/cassandra/utils/binlog/BinLog.java
@@ -486,9 +486,11 @@ public class BinLog implements Runnable
     {
         if (fileOrDirectory.isDirectory())
         {
-            for (File f : fileOrDirectory.tryList())
+            File[] files = fileOrDirectory.tryList();
+            if (files != null)
             {
-                accumulate = FileUtils.deleteWithConfirm(f, accumulate);
+                for (File f : files)
+                    accumulate = FileUtils.deleteWithConfirm(f, accumulate);
             }
         }
         return FileUtils.deleteWithConfirm(fileOrDirectory, accumulate);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org