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

frankgh pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new f77189325b Avoid using ObjectUtils.getFirstNonNull in Schema
f77189325b is described below

commit f77189325bb15bf12ec6acfaeac44301989c7861
Author: Francisco Guerrero <[email protected]>
AuthorDate: Wed May 20 15:23:15 2026 -0700

    Avoid using ObjectUtils.getFirstNonNull in Schema
    
    Patch by Francisco Guerrero; reviewed by Dmitry Konstantinov for 
CASSANDRA-21394
---
 CHANGES.txt                                      | 1 +
 src/java/org/apache/cassandra/schema/Schema.java | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index caa2c73420..11b32e5ff4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 7.0
+ * Avoid using ObjectUtils.getFirstNonNull in Schema (CASSANDRA-21394)
  * Allow nodetool garbagecollect to take a user defined list of SSTables 
(CASSANDRA-16767)
  * Add a guardrail for misprepared statements (CASSANDRA-21139)
 6.0-alpha2
diff --git a/src/java/org/apache/cassandra/schema/Schema.java 
b/src/java/org/apache/cassandra/schema/Schema.java
index e9b6210275..a0e41e316e 100644
--- a/src/java/org/apache/cassandra/schema/Schema.java
+++ b/src/java/org/apache/cassandra/schema/Schema.java
@@ -27,7 +27,6 @@ import java.util.function.Supplier;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
 
-import org.apache.commons.lang3.ObjectUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -243,8 +242,9 @@ public final class Schema implements SchemaProvider
     public Iterable<TableMetadata> getTablesAndViews(String keyspaceName)
     {
         Preconditions.checkNotNull(keyspaceName);
-        KeyspaceMetadata ksm = ObjectUtils.getFirstNonNull(() -> 
distributedKeyspaces().getNullable(keyspaceName),
-                                                           () -> 
localKeyspaces.getNullable(keyspaceName));
+        KeyspaceMetadata ksm = 
distributedKeyspaces().getNullable(keyspaceName);
+        if (ksm == null)
+            ksm = localKeyspaces.getNullable(keyspaceName);
         Preconditions.checkNotNull(ksm, "Keyspace %s not found", keyspaceName);
         return ksm.tablesAndViews();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to