cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [4/4] git commit: fix NPE on invalid CQL DELETE command
Date Thu, 29 Mar 2012 14:34:38 GMT
fix NPE on invalid CQL DELETE command

patch by dbrosius; reviewed by slebresne for CASSANDRA-3755


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b0dfb4cd
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b0dfb4cd
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b0dfb4cd

Branch: refs/heads/trunk
Commit: b0dfb4cdc4717a4ba759cc3353e29cc76235d74e
Parents: 281af5e
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Thu Mar 29 16:26:53 2012 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Thu Mar 29 16:26:53 2012 +0200

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../org/apache/cassandra/cql/DeleteStatement.java  |    7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b0dfb4cd/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index c92a242..e4d207c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -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

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b0dfb4cd/src/java/org/apache/cassandra/cql/DeleteStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/DeleteStatement.java b/src/java/org/apache/cassandra/cql/DeleteStatement.java
index eb46076..1b33a01 100644
--- a/src/java/org/apache/cassandra/cql/DeleteStatement.java
+++ b/src/java/org/apache/cassandra/cql/DeleteStatement.java
@@ -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);


Mime
View raw message