cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasobr...@apache.org
Subject [1/3] cassandra git commit: CQL fromJson(null) throws NullPointerException
Date Tue, 03 Apr 2018 12:37:35 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.11 6f30677b2 -> 28bd6c2a0
  refs/heads/trunk b08b4dcc7 -> d3bd26eb3


CQL fromJson(null) throws NullPointerException

patch by Edward Ribeiro; reviewed by jasobrown for CASSANDRA-13891


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

Branch: refs/heads/cassandra-3.11
Commit: 28bd6c2a031e76b725dd773b949070962555698a
Parents: 6f30677
Author: Edward Ribeiro <edward.ribeiro@gmail.com>
Authored: Fri Jan 26 19:31:23 2018 -0200
Committer: Jason Brown <jasedbrown@gmail.com>
Committed: Tue Apr 3 05:33:32 2018 -0700

----------------------------------------------------------------------
 CHANGES.txt                                                   | 1 +
 .../org/apache/cassandra/cql3/functions/FunctionCall.java     | 2 ++
 .../apache/cassandra/cql3/validation/entities/JsonTest.java   | 7 +++++++
 3 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/28bd6c2a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 62f4345..03b7442 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.11.3
+ * CQL fromJson(null) throws NullPointerException (CASSANDRA-13891)
  * Serialize empty buffer as empty string for json output format (CASSANDRA-14245)
  * Allow logging implementation to be interchanged for embedded testing (CASSANDRA-13396)
  * SASI tokenizer for simple delimiter based entries (CASSANDRA-14247)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/28bd6c2a/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java b/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java
index bcc912f..8dcb3da 100644
--- a/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java
+++ b/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java
@@ -99,6 +99,8 @@ public class FunctionCall extends Term.NonTerminal
 
     private static Term.Terminal makeTerminal(Function fun, ByteBuffer result, ProtocolVersion
version) throws InvalidRequestException
     {
+        if (result == null)
+            return null;
         if (fun.returnType().isCollection())
         {
             switch (((CollectionType) fun.returnType()).kind)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/28bd6c2a/test/unit/org/apache/cassandra/cql3/validation/entities/JsonTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/JsonTest.java b/test/unit/org/apache/cassandra/cql3/validation/entities/JsonTest.java
index 6bca8f8..a475671 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/JsonTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/JsonTest.java
@@ -249,6 +249,13 @@ public class JsonTest extends CQLTester
 
         // handle nulls
         execute("INSERT INTO %s (k, asciival) VALUES (?, fromJson(?))", 0, null);
+        assertRows(execute("SELECT k, asciival FROM %s WHERE k = ?", 0), row(0, null));
+
+        execute("INSERT INTO %s (k, frozenmapval) VALUES (?, fromJson(?))", 0, null);
+        assertRows(execute("SELECT k, frozenmapval FROM %s WHERE k = ?", 0), row(0, null));
+
+        execute("INSERT INTO %s (k, udtval) VALUES (?, fromJson(?))", 0, null);
+        assertRows(execute("SELECT k, udtval FROM %s WHERE k = ?", 0), row(0, null));
 
         // ================ ascii ================
         execute("INSERT INTO %s (k, asciival) VALUES (?, fromJson(?))", 0, "\"ascii text\"");


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message