Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B07DD200BBD for ; Tue, 4 Oct 2016 03:20:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AF263160ADC; Tue, 4 Oct 2016 01:20:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F3FBE160AE5 for ; Tue, 4 Oct 2016 03:20:18 +0200 (CEST) Received: (qmail 61853 invoked by uid 500); 4 Oct 2016 01:20:16 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 61650 invoked by uid 99); 4 Oct 2016 01:20:16 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2016 01:20:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id F28A8E009E; Tue, 4 Oct 2016 01:20:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: stefania@apache.org To: commits@cassandra.apache.org Date: Tue, 04 Oct 2016 01:20:16 -0000 Message-Id: <8a1b65dfaafe44fba0c7ef1dd961043b@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/6] cassandra git commit: Fix NPE in ComponentOfSlice.isEQ() archived-at: Tue, 04 Oct 2016 01:20:19 -0000 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 Authored: Mon Sep 26 17:02:16 2016 +0800 Committer: Stefania Alborghetti 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 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()); + } }