cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tylerho...@apache.org
Subject git commit: Fix NPE when unknown prepared statement ID is used
Date Fri, 27 Jun 2014 14:38:25 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 9e3d13e70 -> 12c694edb


Fix NPE when unknown prepared statement ID is used

Patch by Tyler Hobbs; reviewed by Sylvain Lebresne for CASSANDRA-7454


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

Branch: refs/heads/cassandra-2.1
Commit: 12c694edb6910e11bae25231ba1517a8599cd6ff
Parents: 9e3d13e
Author: Tyler Hobbs <tyler@datastax.com>
Authored: Fri Jun 27 09:35:53 2014 -0500
Committer: Tyler Hobbs <tyler@datastax.com>
Committed: Fri Jun 27 09:35:53 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                                    | 1 +
 .../apache/cassandra/transport/messages/ExecuteMessage.java    | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/12c694ed/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a04f76a..171879e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
 2.1.0
  * Improve schema merge performance (CASSANDRA-7444)
+ * Fix NPE when unknown prepared statement ID is used (CASSANDRA-7454)
 Merged from 2.0:
  * Fix CC#collectTimeOrderedData() tombstone optimisations (CASSANDRA-7394)
  * Support DISTINCT for static columns and fix behaviour when DISTINC is

http://git-wip-us.apache.org/repos/asf/cassandra/blob/12c694ed/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
index d618f43..78182b2 100644
--- a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
@@ -102,12 +102,12 @@ public class ExecuteMessage extends Message.Request
         {
             QueryHandler handler = state.getClientState().getCQLQueryHandler();
             ParsedStatement.Prepared prepared = handler.getPrepared(statementId);
+            if (prepared == null)
+                throw new PreparedQueryNotFoundException(statementId);
+
             options.prepare(prepared.boundNames);
             CQLStatement statement = prepared.statement;
 
-            if (statement == null)
-                throw new PreparedQueryNotFoundException(statementId);
-
             if (options.getPageSize() == 0)
                 throw new ProtocolException("The page size cannot be 0");
 


Mime
View raw message