NullPointerException when calling get_range_slice()
---------------------------------------------------

                 Key: CASSANDRA-643
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-643
             Project: Cassandra
          Issue Type: Bug
          Components: Core
    Affects Versions: 0.5
         Environment: Linux
            Reporter: Jonathan Hseu


This bug affects 0.5.0beta2.

In the SlicePredicate struct, column_names is defined as "optional", and so can 
be null.

get_range_slice() passes the "predicate.getColumn_names()" to 
"ThriftValidation.validateColumns()" without first checking if it's null, 
resulting in the following exception:

java.lang.NullPointerException
        at 
org.apache.cassandra.service.ThriftValidation.validateColumns(ThriftValidation.java:162)
        at 
org.apache.cassandra.service.ThriftValidation.validateColumns(ThriftValidation.java:181)
        at 
org.apache.cassandra.service.CassandraServer.get_range_slice(CassandraServer.java:562)
        at 
org.apache.cassandra.service.Cassandra$Processor$get_range_slice.process(Cassandra.java:1024)
        at 
org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:817)
        at 
org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:253)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

Strangely enough, calling it from python doesn't generate this exception, but 
calling it from C++ does, with the following code:
shared_ptr<TTransport> transport(new TSocket(host, port));
shared_ptr<TProtocol> proto(new TBinaryProtocol(transport));
CassandraClient client(proto);
transport->open();

ColumnParent column_parent;
column_parent.column_family = "Test";
SlicePredicate slice_predicate;

std::vector<KeySlice> keys;
client.get_range_slice(keys, keyspace, column_parent, slice_predicate, "", "", 
100, ONE);


The fix is trivial, just check that predicate.getColumn_names() is not null in 
line 562 of CassandraServer.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to