Program: 7839
Project: 7839
Buggy source:
private void populateRowCache() throws IOException {
  Scan scan=new Scan();
  scan.setCaching(MAX_CACHE_ROWS);
  scan.setStartRow(startRow);
  scan.setStopRow(getStopRow());
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.DATA_COLUMN);
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.META_COLUMN);
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.STATE_COLUMN);
  scan.setMaxVersions();
  long readPointer=transaction.getReadPointer();
  long[] excludedList=transaction.getExcludedList();
  ResultScanner scanner=hTable.getScanner(scan);
  while (entryCache.size() < MAX_CACHE_ROWS) {
    Result[] results=scanner.next(MAX_CACHE_ROWS);
    if (results.length == 0) {
      break;
    }
    for (    Result result : results) {
      byte[] rowKey=result.getRow();
      if (entryCache.containsKey(rowKey) || consumingEntries.containsKey(rowKey)) {
        continue;
      }
      if (excludedList.length == 0) {
        startRow=rowKey;
      }
      long writePointer=Bytes.toLong(rowKey,queueName.toBytes().length,Longs.BYTES);
      if (writePointer > readPointer) {
        break;
      }
      if (Arrays.binarySearch(excludedList,writePointer) >= 0) {
        continue;
      }
      KeyValue metaColumn=result.getColumnLatest(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.META_COLUMN);
      KeyValue stateColumn=result.getColumnLatest(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.STATE_COLUMN);
      int counter=Bytes.toInt(rowKey,rowKey.length - 4,Ints.BYTES);
      if (!shouldInclude(writePointer,counter,metaColumn,stateColumn)) {
        continue;
      }
      entryCache.put(rowKey,new Entry(rowKey,result.getValue(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.DATA_COLUMN),result.getValue(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.STATE_COLUMN)));
    }
  }
  scanner.close();
}

Fixed version (ground truth):
private void populateRowCache() throws IOException {
  Scan scan=new Scan();
  scan.setCaching(MAX_CACHE_ROWS);
  scan.setStartRow(startRow);
  scan.setStopRow(getStopRow());
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.DATA_COLUMN);
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.META_COLUMN);
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName);
  scan.setMaxVersions();
  long readPointer=transaction.getReadPointer();
  long[] excludedList=transaction.getExcludedList();
  ResultScanner scanner=hTable.getScanner(scan);
  while (entryCache.size() < MAX_CACHE_ROWS) {
    Result[] results=scanner.next(MAX_CACHE_ROWS);
    if (results.length == 0) {
      break;
    }
    for (    Result result : results) {
      byte[] rowKey=result.getRow();
      if (entryCache.containsKey(rowKey) || consumingEntries.containsKey(rowKey)) {
        continue;
      }
      long writePointer=Bytes.toLong(rowKey,queueName.toBytes().length,Longs.BYTES);
      if (writePointer > readPointer) {
        break;
      }
      if (Arrays.binarySearch(excludedList,writePointer) >= 0) {
        continue;
      }
      KeyValue metaColumn=result.getColumnLatest(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.META_COLUMN);
      KeyValue stateColumn=result.getColumnLatest(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName);
      int counter=Bytes.toInt(rowKey,rowKey.length - 4,Ints.BYTES);
      if (!shouldInclude(writePointer,counter,metaColumn,stateColumn)) {
        continue;
      }
      entryCache.put(rowKey,new Entry(rowKey,result.getValue(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.DATA_COLUMN),result.getValue(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName)));
    }
  }
  scanner.close();
}