mirror of https://github.com/apache/cassandra
fix NPE on invalid CQL DELETE command
patch by dbrosius; reviewed by slebresne for CASSANDRA-3755
This commit is contained in:
parent
281af5e4f7
commit
b0dfb4cdc4
|
|
@ -13,6 +13,7 @@
|
|||
* fix race leading to super columns assertion failure (CASSANDRA-3957)
|
||||
* ensure that directory is selected for compaction for user-defined
|
||||
tasks and upgradesstables (CASSANDRA-3985)
|
||||
* fix NPE on invalid CQL delete command (CASSANDRA-3755)
|
||||
|
||||
|
||||
1.0.8
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ public class DeleteStatement extends AbstractModification
|
|||
/** {@inheritDoc} */
|
||||
public List<IMutation> prepareRowMutations(String keyspace, ClientState clientState, Long timestamp) throws InvalidRequestException
|
||||
{
|
||||
CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);
|
||||
|
||||
clientState.hasColumnFamilyAccess(columnFamily, Permission.WRITE);
|
||||
AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();
|
||||
|
||||
|
|
@ -81,18 +83,17 @@ public class DeleteStatement extends AbstractModification
|
|||
|
||||
for (Term key : keys)
|
||||
{
|
||||
rowMutations.add(mutationForKey(key.getByteBuffer(keyType), keyspace, timestamp, clientState));
|
||||
rowMutations.add(mutationForKey(key.getByteBuffer(keyType), keyspace, timestamp, clientState, metadata));
|
||||
}
|
||||
|
||||
return rowMutations;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public RowMutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ClientState clientState) throws InvalidRequestException
|
||||
public RowMutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ClientState clientState, CFMetaData metadata) throws InvalidRequestException
|
||||
{
|
||||
RowMutation rm = new RowMutation(keyspace, key);
|
||||
|
||||
CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);
|
||||
QueryProcessor.validateKeyAlias(metadata, keyName);
|
||||
|
||||
AbstractType comparator = metadata.getComparatorFor(null);
|
||||
|
|
|
|||
Loading…
Reference in New Issue