Avoid using ObjectUtils.getFirstNonNull in Schema

Patch by Francisco Guerrero; reviewed by Dmitry Konstantinov for CASSANDRA-21394
This commit is contained in:
Francisco Guerrero 2026-05-20 15:23:15 -07:00
parent 706b71e360
commit f77189325b
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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();
}