You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by st...@apache.org on 2016/10/04 01:20:16 UTC
[2/6] cassandra git commit: Fix NPE in ComponentOfSlice.isEQ()
Fix NPE in ComponentOfSlice.isEQ()
Patch by Stefania Alborghetti; reviewed by Swen Moczarski for CASSANDRA-12706
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/79a16e5e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/79a16e5e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/79a16e5e
Branch: refs/heads/cassandra-3.X
Commit: 79a16e5e977bea4ec86fb3fef97a7ea0719a9095
Parents: cd8a98a
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Mon Sep 26 17:02:16 2016 +0800
Committer: Stefania Alborghetti <st...@datastax.com>
Committed: Tue Oct 4 09:09:46 2016 +0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/db/Slices.java | 2 +-
.../db/SinglePartitionSliceCommandTest.java | 21 ++++++++++++++++++++
3 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/79a16e5e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d12a8f8..cbf9ab1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.10
+ * Fix NPE in ComponentOfSlice.isEQ() (CASSANDRA-12706)
* Fix failure in LogTransactionTest (CASSANDRA-12632)
* Fix potentially incomplete non-frozen UDT values when querying with the
full primary key specified (CASSANDRA-12605)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/79a16e5e/src/java/org/apache/cassandra/db/Slices.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Slices.java b/src/java/org/apache/cassandra/db/Slices.java
index bb354a1..269386e 100644
--- a/src/java/org/apache/cassandra/db/Slices.java
+++ b/src/java/org/apache/cassandra/db/Slices.java
@@ -745,7 +745,7 @@ public abstract class Slices implements Iterable<Slice>
public boolean isEQ()
{
- return startValue.equals(endValue);
+ return Objects.equals(startValue, endValue);
}
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/79a16e5e/test/unit/org/apache/cassandra/db/SinglePartitionSliceCommandTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/SinglePartitionSliceCommandTest.java b/test/unit/org/apache/cassandra/db/SinglePartitionSliceCommandTest.java
index b5d8159..7f59e2f 100644
--- a/test/unit/org/apache/cassandra/db/SinglePartitionSliceCommandTest.java
+++ b/test/unit/org/apache/cassandra/db/SinglePartitionSliceCommandTest.java
@@ -215,4 +215,25 @@ public class SinglePartitionSliceCommandTest
checkForS(pi);
}
}
+
+ @Test
+ public void toCQLStringIsSafeToCall() throws IOException
+ {
+ DecoratedKey key = cfm.decorateKey(ByteBufferUtil.bytes("k1"));
+
+ ColumnFilter columnFilter = ColumnFilter.selection(PartitionColumns.of(s));
+ Slice slice = Slice.make(Slice.Bound.BOTTOM, Slice.Bound.inclusiveEndOf(ByteBufferUtil.bytes("i1")));
+ ClusteringIndexSliceFilter sliceFilter = new ClusteringIndexSliceFilter(Slices.with(cfm.comparator, slice), false);
+ ReadCommand cmd = new SinglePartitionReadCommand(false, MessagingService.VERSION_30, true, cfm,
+ FBUtilities.nowInSeconds(),
+ columnFilter,
+ RowFilter.NONE,
+ DataLimits.NONE,
+ key,
+ sliceFilter);
+
+ String ret = cmd.toCQLString();
+ Assert.assertNotNull(ret);
+ Assert.assertFalse(ret.isEmpty());
+ }
}