Program: 97908
Project: 97908
Buggy source:
@SuppressWarnings("String_Node_Str") private void loadCacheBackward(){
  byte[] previousKey=null;
  Holder<byte[]> keyHolder=rowKeys.previousImpl();
  if (keyHolder != null)   previousKey=keyHolder.getValue();
  if (cachedRows != null && cachedRows.hasPrevious())   return;
 else   if (previousKey == null)   return;
  List<RowHolder<Row>> results=new ArrayList<RowHolder<Row>>();
  List<byte[]> keysToLookup=new ArrayList<byte[]>();
  while (results.size() < batchSize && previousKey != null) {
    RowHolder<Row> result=cache.fromCache(cf,previousKey);
    if (result == null)     keysToLookup.add(0,previousKey);
    results.add(result);
    previousKey=null;
    keyHolder=rowKeys.previousImpl();
    if (keyHolder != null)     previousKey=keyHolder.getValue();
  }
  Iterator<com.netflix.astyanax.model.Row<byte[],byte[]>> resultingRows=null;
  if (keysToLookup.size() > 0) {
    if (list != null)     list.beforeFetchingNextBatch();
    ColumnFamily<byte[],byte[]> cf=info.getColumnFamilyObj();
    ColumnFamilyQuery<byte[],byte[]> q2=keyspace.prepareQuery(cf);
    RowSliceQuery<byte[],byte[]> slice=q2.getKeySlice(keysToLookup);
    OperationResult<Rows<byte[],byte[]>> result=execute(slice);
    Rows<byte[],byte[]> rows=result.getResult();
    resultingRows=rows.iterator();
    if (list != null)     list.afterFetchingNextBatch(rows.size());
  }
 else {
    resultingRows=new ArrayList<com.netflix.astyanax.model.Row<byte[],byte[]>>().iterator();
  }
  Map<ByteArray,KeyValue<Row>> map=new HashMap<ByteArray,KeyValue<Row>>();
  while (resultingRows.hasNext()) {
    com.netflix.astyanax.model.Row<byte[],byte[]> row=resultingRows.next();
    KeyValue<Row> kv=new KeyValue<Row>();
    kv.setKey(row.getKey());
    if (!row.getColumns().isEmpty()) {
      Row r=rowProvider.get();
      r.setKey(row.getKey());
      CassandraSession.processColumns(row,r);
      kv.setValue(r);
    }
    ByteArray b=new ByteArray(row.getKey());
    map.put(b,kv);
    cache.cacheRow(cf,row.getKey(),kv.getValue());
  }
  List<KeyValue<Row>> finalRes=new ArrayList<KeyValue<Row>>();
  Iterator<byte[]> keyIter=keysToLookup.iterator();
  for (  RowHolder<Row> r : results) {
    if (r == null) {
      byte[] key=keyIter.next();
      ByteArray b=new ByteArray(key);
      KeyValue<Row> kv=map.get(b);
      finalRes.add(kv);
    }
 else {
      Row row=r.getValue();
      KeyValue<Row> kv=new KeyValue<Row>();
      kv.setKey(r.getKey());
      kv.setValue(row);
      finalRes.add(kv);
    }
  }
  cachedRows=finalRes.listIterator();
  while (cachedRows.hasNext())   cachedRows.next();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void loadCacheBackward(){
  if (cachedRows != null && cachedRows.hasPrevious())   return;
  List<RowHolder<Row>> results=new ArrayList<RowHolder<Row>>();
  List<byte[]> keysToLookup=new ArrayList<byte[]>();
  while (results.size() < batchSize) {
    Holder<byte[]> keyHolder=rowKeys.previousImpl();
    if (keyHolder == null)     break;
    byte[] previousKey=keyHolder.getValue();
    RowHolder<Row> result=cache.fromCache(cf,previousKey);
    if (result == null)     keysToLookup.add(0,previousKey);
    results.add(result);
  }
  Iterator<com.netflix.astyanax.model.Row<byte[],byte[]>> resultingRows=null;
  if (keysToLookup.size() > 0) {
    if (list != null)     list.beforeFetchingNextBatch();
    ColumnFamily<byte[],byte[]> cf=info.getColumnFamilyObj();
    ColumnFamilyQuery<byte[],byte[]> q2=keyspace.prepareQuery(cf);
    RowSliceQuery<byte[],byte[]> slice=q2.getKeySlice(keysToLookup);
    OperationResult<Rows<byte[],byte[]>> result=execute(slice);
    Rows<byte[],byte[]> rows=result.getResult();
    resultingRows=rows.iterator();
    if (list != null)     list.afterFetchingNextBatch(rows.size());
  }
 else {
    resultingRows=new ArrayList<com.netflix.astyanax.model.Row<byte[],byte[]>>().iterator();
  }
  Map<ByteArray,KeyValue<Row>> map=new HashMap<ByteArray,KeyValue<Row>>();
  while (resultingRows.hasNext()) {
    com.netflix.astyanax.model.Row<byte[],byte[]> row=resultingRows.next();
    KeyValue<Row> kv=new KeyValue<Row>();
    kv.setKey(row.getKey());
    if (!row.getColumns().isEmpty()) {
      Row r=rowProvider.get();
      r.setKey(row.getKey());
      CassandraSession.processColumns(row,r);
      kv.setValue(r);
    }
    ByteArray b=new ByteArray(row.getKey());
    map.put(b,kv);
    cache.cacheRow(cf,row.getKey(),kv.getValue());
  }
  List<KeyValue<Row>> finalRes=new ArrayList<KeyValue<Row>>();
  Iterator<byte[]> keyIter=keysToLookup.iterator();
  for (  RowHolder<Row> r : results) {
    if (r == null) {
      byte[] key=keyIter.next();
      ByteArray b=new ByteArray(key);
      KeyValue<Row> kv=map.get(b);
      finalRes.add(kv);
    }
 else {
      Row row=r.getValue();
      KeyValue<Row> kv=new KeyValue<Row>();
      kv.setKey(r.getKey());
      kv.setValue(row);
      finalRes.add(kv);
    }
  }
  cachedRows=finalRes.listIterator();
  while (cachedRows.hasNext())   cachedRows.next();
}