You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Blake Eggleston (Jira)" <ji...@apache.org> on 2022/06/10 20:29:00 UTC

[jira] [Commented] (CASSANDRA-17596) Fix NPE in SimpleBuilders.ParititionUpdateBulder.RTBuilder.build

    [ https://issues.apache.org/jira/browse/CASSANDRA-17596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17552956#comment-17552956 ] 

Blake Eggleston commented on CASSANDRA-17596:
---------------------------------------------

AFAICT, the only way this method will throw an NPE is if null is passed in as the only value argument. C* doesn't allow null clustering values, and in general, the assumption that clustering objects contain non-null arrays is pretty baked into Cassandra code. So null ending up in this method would be an issue with the calling code.

I'm inclined to say this is an issue with either the method's argument validation and/or documentation about what's expected. The method behaves as expected if you pass in no arguments (creates an empty clustering value). 

Regarding 3.x branches... I think the equivalent method is ClusteringComparator.make. If this ends up being just a doc/validation change, I think only updating 4.x is ok, but I'd lean towards classifying this as wontfix

> Fix NPE in SimpleBuilders.ParititionUpdateBulder.RTBuilder.build
> ----------------------------------------------------------------
>
>                 Key: CASSANDRA-17596
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17596
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Legacy/Core
>            Reporter: Stefan Miklosovic
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 4.0.5, 4.1-rc, 4.x
>
>
> These two arrays are not initialised (1) which means that if I do not set start nor end, when ClusteringBound.create is called, it will be null, but it will fail here (2) as values will be null.
> The fix consists of check if values are null and if they are, we build that bound immediately.
> (1) https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/SimpleBuilders.java#L257-L258
> (2) https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/ClusteringBound.java#L128



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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