Program: 2540
Project: 2540
Buggy source:
@Override protected ResultObjectProvider executeQuery(Executor ex,ClassMetaData base,ClassMetaData[] types,boolean subclasses,ExpressionFactory[] facts,QueryExpressions[] parsed,Object[] params,Range range){
  log.debug("String_Node_Str");
  IndexExpressionVisitor visitor=new IndexExpressionVisitor((CassandraClassMetaData)base);
  parsed[0].filter.acceptVisit(visitor);
  List<IndexQuery> queries=visitor.getVisitors();
  SortedSet<DynamicComposite> columnResults=null;
  AbstractIndexOperation indexOp=null;
  for (  IndexQuery query : queries) {
    indexOp=getIndexOp(query,parsed[0].ordering,parsed[0].ascending,(CassandraClassMetaData)base);
    log.debug("String_Node_Str",new Object[]{indexOp,base,range});
    if (columnResults == null) {
      columnResults=new TreeSet<DynamicComposite>(indexOp.getComprator());
    }
    indexOp.scanIndex(query,columnResults,conf.getKeyspace());
  }
  if (range.start != 0 || range.end != Long.MAX_VALUE) {
    long current=0;
    DynamicComposite start=null;
    DynamicComposite end=null;
    Iterator<DynamicComposite> currentSet=columnResults.iterator();
    for (; current <= range.start && currentSet.hasNext(); current++) {
      start=currentSet.next();
    }
    long size=range.end - range.start;
    for (long index=0; index < size && currentSet.hasNext(); index++) {
      end=currentSet.next();
    }
    if (start != null && end != null) {
      columnResults=columnResults.subSet(start,end);
    }
  }
  CassandraResultObjectProvider results=new CassandraResultObjectProvider(columnResults,this.getContext().getStoreContext(),ctx.getFetchConfiguration(),(CassandraClassMetaData)base);
  return results;
}

Fixed version (ground truth):
@Override protected ResultObjectProvider executeQuery(Executor ex,ClassMetaData base,ClassMetaData[] types,boolean subclasses,ExpressionFactory[] facts,QueryExpressions[] parsed,Object[] params,Range range){
  log.debug("String_Node_Str");
  IndexExpressionVisitor visitor=new IndexExpressionVisitor((CassandraClassMetaData)base,params);
  parsed[0].filter.acceptVisit(visitor);
  List<IndexQuery> queries=visitor.getVisitors();
  SortedSet<DynamicComposite> columnResults=null;
  AbstractIndexOperation indexOp=null;
  for (  IndexQuery query : queries) {
    indexOp=getIndexOp(query,parsed[0].ordering,parsed[0].ascending,(CassandraClassMetaData)base);
    log.debug("String_Node_Str",new Object[]{indexOp,base,range});
    if (columnResults == null) {
      columnResults=new TreeSet<DynamicComposite>(indexOp.getComprator());
    }
    indexOp.scanIndex(query,columnResults,conf.getKeyspace());
  }
  if (range.start != 0 || range.end != Long.MAX_VALUE) {
    long current=0;
    DynamicComposite start=null;
    DynamicComposite end=null;
    Iterator<DynamicComposite> currentSet=columnResults.iterator();
    for (; current <= range.start && currentSet.hasNext(); current++) {
      start=currentSet.next();
    }
    long size=range.end - range.start;
    for (long index=0; index < size && currentSet.hasNext(); index++) {
      end=currentSet.next();
    }
    if (start != null && end != null) {
      columnResults=columnResults.subSet(start,end);
    }
  }
  CassandraResultObjectProvider results=new CassandraResultObjectProvider(columnResults,this.getContext().getStoreContext(),ctx.getFetchConfiguration(),(CassandraClassMetaData)base);
  return results;
}