[ 
https://issues.apache.org/jira/browse/CASSANDRA-21738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Deepak Kumar Jothimanickam updated CASSANDRA-21738:
---------------------------------------------------
    Test and Documentation Plan: 
Created PR-[https://github.com/apache/cassandra/pull/5329]
can someone review
                         Status: Patch Available  (was: In Progress)

> NullPointerException when an empty value is bound to USING TIMESTAMP
> --------------------------------------------------------------------
>
>                 Key: CASSANDRA-21738
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21738
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: CQL/Semantics
>            Reporter: Nadav Har'El
>            Assignee: Deepak Kumar Jothimanickam
>            Priority: Normal
>             Fix For: 5.0.x, 6.x, 7.x
>
>
> When a prepared statement's {{USING TIMESTAMP ?}} bind marker is given an 
> empty (zero-length) value, the request fails with a server error caused by a 
> NullPointerException:
> {code:sql}
> CREATE TABLE ks.t (k int PRIMARY KEY, v int);
> -- prepare, and bind ? to an empty (0-byte) value:
> INSERT INTO ks.t (k, v) VALUES (1, 1) USING TIMESTAMP ?;
> {code}
> {noformat}
> Server error: java.lang.NullPointerException: Cannot invoke 
> "java.lang.Long.longValue()" because the return value of ... is null
> {noformat}
> Reproduced on Cassandra 5.0.9 and 6.0-alpha2.
> CASSANDRA-17822 fixed the same NPE for {{USING TTL ?}}: 
> {{Attributes.getTimeToLive()}} now treats an empty value like null, i.e. no 
> TTL ({{InsertTest.testEmptyTTL}}). But {{Attributes.getTimestamp()}} has no 
> such check. It validates the empty buffer, and 
> {{LongType.instance.compose()}} returns null for it, which is then unboxed 
> into a long.
> Expected: an InvalidRequestException, like the one for a null value ("Invalid 
> null value of timestamp"), instead of a server error.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to