Program: 82379
Project: 82379
Buggy source:
public static BlurResults convertToHits(BlurResultIterable hitsIterable,BlurQuery query,AtomicLongArray facetCounts,ExecutorService executor,Selector selector,final Iface iface,final String table) throws InterruptedException, ExecutionException, BlurException {
  BlurResults results=new BlurResults();
  results.setTotalResults(hitsIterable.getTotalResults());
  results.setShardInfo(hitsIterable.getShardInfo());
  if (query.minimumNumberOfResults > 0) {
    hitsIterable.skipTo(query.start);
    int count=0;
    BlurIterator<BlurResult,BlurException> iterator=hitsIterable.iterator();
    while (iterator.hasNext() && count < query.fetch) {
      results.addToResults(iterator.next());
      count++;
    }
  }
  if (results.results == null) {
    results.results=new ArrayList<BlurResult>();
  }
  if (facetCounts != null) {
    results.facetCounts=BlurUtil.toList(facetCounts);
  }
  if (selector != null) {
    List<Future<FetchResult>> futures=new ArrayList<Future<FetchResult>>();
    for (int i=0; i < results.results.size(); i++) {
      BlurResult result=results.results.get(i);
      final Selector s=new Selector(selector);
      s.setLocationId(result.locationId);
      futures.add(executor.submit(new Callable<FetchResult>(){
        @Override public FetchResult call() throws Exception {
          return iface.fetchRow(table,s);
        }
      }
));
    }
    for (int i=0; i < results.results.size(); i++) {
      Future<FetchResult> future=futures.get(i);
      BlurResult result=results.results.get(i);
      result.setFetchResult(future.get());
    }
  }
  results.query=query;
  results.query.selector=selector;
  return results;
}

Fixed version (ground truth):
public static BlurResults convertToHits(BlurResultIterable hitsIterable,BlurQuery query,AtomicLongArray facetCounts,ExecutorService executor,Selector selector,final Iface iface,final String table) throws InterruptedException, ExecutionException, BlurException {
  BlurResults results=new BlurResults();
  results.setTotalResults(hitsIterable.getTotalResults());
  results.setShardInfo(hitsIterable.getShardInfo());
  if (query.minimumNumberOfResults > 0) {
    hitsIterable.skipTo(query.start);
    BlurIterator<BlurResult,BlurException> iterator=hitsIterable.iterator();
    for (int count=0; count < query.fetch && iterator.hasNext(); count++) {
      results.addToResults(iterator.next());
    }
  }
  if (results.results == null) {
    results.results=new ArrayList<BlurResult>();
  }
  if (facetCounts != null) {
    results.facetCounts=BlurUtil.toList(facetCounts);
  }
  if (selector != null) {
    List<Future<FetchResult>> futures=new ArrayList<Future<FetchResult>>();
    for (int i=0; i < results.results.size(); i++) {
      BlurResult result=results.results.get(i);
      final Selector s=new Selector(selector);
      s.setLocationId(result.locationId);
      futures.add(executor.submit(new Callable<FetchResult>(){
        @Override public FetchResult call() throws Exception {
          return iface.fetchRow(table,s);
        }
      }
));
    }
    for (int i=0; i < results.results.size(); i++) {
      Future<FetchResult> future=futures.get(i);
      BlurResult result=results.results.get(i);
      result.setFetchResult(future.get());
    }
  }
  results.query=query;
  results.query.selector=selector;
  return results;
}