Fix NPE in ComponentOfSlice.isEQ()

Patch by Stefania Alborghetti; reviewed by Swen Moczarski for CASSANDRA-12706
This commit is contained in:
Stefania Alborghetti 2016-09-26 17:02:16 +08:00
parent cd8a98a2dd
commit 79a16e5e97
3 changed files with 23 additions and 1 deletions

View File

@ -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)

View File

@ -745,7 +745,7 @@ public abstract class Slices implements Iterable<Slice>
public boolean isEQ()
{
return startValue.equals(endValue);
return Objects.equals(startValue, endValue);
}
}
}

View File

@ -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());
}
}