Program: 35183
Project: 35183
Buggy source:
/** 
 * Generic bulk get operation for b+tree items. Public methods call this method.
 * @param getBulkList  list of operation parameters (item keys, element key range, and so on)
 * @param offset  start index of the elements
 * @param count  number of elements to fetch
 * @param reverse  forward or backward
 * @param tc  transcoder to serialize and unserialize value
 * @return future holding the map of item key and the fetched elements from that key
 */
private <T>CollectionGetBulkFuture<Map<String,BTreeGetResult<Long,T>>> btreeGetBulk(final List<BTreeGetBulk<T>> getBulkList,final int offset,final int count,final boolean reverse,final Transcoder<T> tc){
  final CountDownLatch latch=new CountDownLatch(getBulkList.size());
  final ConcurrentLinkedQueue<Operation> ops=new ConcurrentLinkedQueue<Operation>();
  final Map<String,BTreeGetResult<Long,T>> result=new ConcurrentHashMap<String,BTreeGetResult<Long,T>>();
  for (  BTreeGetBulk<T> getBulk : getBulkList) {
    Operation op=opFact.bopGetBulk(getBulk,new BTreeGetBulkOperation.Callback<T>(){
      @Override public void receivedStatus(      OperationStatus status){
      }
      @Override public void complete(){
        latch.countDown();
      }
      @Override public void gotKey(      String key,      int elementCount,      OperationStatus status){
        result.put(key,new BTreeGetResult<Long,T>((elementCount > 0) ? new TreeMap<Long,BTreeElement<Long,T>>() : null,new CollectionOperationStatus(status)));
      }
      @Override public void gotElement(      String key,      Object subkey,      int flags,      byte[] eflag,      byte[] data){
        result.get(key).addElement(new BTreeElement<Long,T>((Long)subkey,eflag,tc.decode(new CachedData(flags,data,tc.getMaxSize()))));
      }
    }
);
    ops.add(op);
    addOp(getBulk.getRepresentKey(),op);
  }
  return new CollectionGetBulkFuture<Map<String,BTreeGetResult<Long,T>>>(latch,ops,result,operationTimeout);
}

Fixed version (ground truth):
/** 
 * Generic bulk get operation for b+tree items. Public methods call this method.
 * @param getBulkList  list of operation parameters (item keys, element key range, and so on)
 * @param offset  start index of the elements
 * @param count  number of elements to fetch
 * @param reverse  forward or backward
 * @param tc  transcoder to serialize and unserialize value
 * @return future holding the map of item key and the fetched elements from that key
 */
private <T>CollectionGetBulkFuture<Map<String,BTreeGetResult<Long,T>>> btreeGetBulk(final List<BTreeGetBulk<T>> getBulkList,final int offset,final int count,final boolean reverse,final Transcoder<T> tc){
  final CountDownLatch latch=new CountDownLatch(getBulkList.size());
  final ConcurrentLinkedQueue<Operation> ops=new ConcurrentLinkedQueue<Operation>();
  final Map<String,BTreeGetResult<Long,T>> result=new ConcurrentHashMap<String,BTreeGetResult<Long,T>>();
  for (  BTreeGetBulk<T> getBulk : getBulkList) {
    Operation op=opFact.bopGetBulk(getBulk,new BTreeGetBulkOperation.Callback<T>(){
      @Override public void receivedStatus(      OperationStatus status){
      }
      @Override public void complete(){
        latch.countDown();
      }
      @Override public void gotKey(      String key,      int elementCount,      OperationStatus status){
        TreeMap<Long,BTreeElement<Long,T>> tree=null;
        if (elementCount > 0) {
          tree=new TreeMap<Long,BTreeElement<Long,T>>((reverse) ? Collections.reverseOrder() : null);
        }
        result.put(key,new BTreeGetResult<Long,T>(tree,new CollectionOperationStatus(status)));
      }
      @Override public void gotElement(      String key,      Object subkey,      int flags,      byte[] eflag,      byte[] data){
        result.get(key).addElement(new BTreeElement<Long,T>((Long)subkey,eflag,tc.decode(new CachedData(flags,data,tc.getMaxSize()))));
      }
    }
);
    ops.add(op);
    addOp(getBulk.getRepresentKey(),op);
  }
  return new CollectionGetBulkFuture<Map<String,BTreeGetResult<Long,T>>>(latch,ops,result,operationTimeout);
}