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

Stefan Miklosovic edited comment on CASSANDRA-17596 at 6/10/22 9:11 PM:
------------------------------------------------------------------------

That is an interesting take on that. I would say that no matter what I do, I 
should never get NPE. The API should prevent me from hitting this problem 
altogether. If I do not set "end()" at all, builder should throw an exception 
that I should set it, not throwing NPE I need to investigate. 

I hit this issue when I was reusing Cassandra codebase in some external project 
of ours where I was building this stuff by hand. I understand that it "makes 
sense" in Cassandra project context but as soon as one is about to reuse this 
code elsewhere, he discovers bugs like these.


was (Author: smiklosovic):
That is an interesting take on that. I would say that no matter what I do, I 
should never get NPE. The API should prevent me from hitting this problem 
altogether. If I do not set "end()" at all, builder should throw an exception 
that I should set it, not throwing NPE I need to investigate. 

> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to