cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [06/13] cassandra git commit: Safely handle empty buffers when outputting to JSON
Date Fri, 15 Sep 2017 11:29:18 GMT
Safely handle empty buffers when outputting to JSON

patch by jasobrown, reviewed by Sam Tunnicliffe for CASSANDRA-13868


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

Branch: refs/heads/cassandra-3.0
Commit: a8e2dc52409ce0dc7476d60b3adee34c547f0b14
Parents: 43e2a10
Author: Jason Brown <jasedbrown@gmail.com>
Authored: Thu Sep 14 10:49:57 2017 -0700
Committer: Sam Tunnicliffe <sam@beobal.com>
Committed: Fri Sep 15 11:49:30 2017 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                 | 1 +
 src/java/org/apache/cassandra/cql3/selection/Selection.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a8e2dc52/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d4d9e4f..0af156f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.11
+ * Safely handle empty buffers when outputting to JSON (CASSANDRA-13868)
  * Copy session properties on cqlsh.py do_login (CASSANDRA-13847)
  * Fix load over calculated issue in IndexSummaryRedistribution (CASSANDRA-13738)
  * Fix compaction and flush exception not captured (CASSANDRA-13833)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a8e2dc52/src/java/org/apache/cassandra/cql3/selection/Selection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/selection/Selection.java b/src/java/org/apache/cassandra/cql3/selection/Selection.java
index 6016059..dc4e240 100644
--- a/src/java/org/apache/cassandra/cql3/selection/Selection.java
+++ b/src/java/org/apache/cassandra/cql3/selection/Selection.java
@@ -377,7 +377,7 @@ public abstract class Selection
                 sb.append('"');
                 sb.append(Json.quoteAsJsonString(columnName));
                 sb.append("\": ");
-                if (buffer == null)
+                if (buffer == null || !buffer.hasRemaining())
                     sb.append("null");
                 else
                     sb.append(spec.type.toJSONString(buffer, protocolVersion));


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


Mime
View raw message