Program: 82426
Project: 82426
Buggy source:
public BlurResults convertToBlurResults(BlurResultIterable hitsIterable,BlurQuery query,AtomicLongArray facetCounts,ExecutorService executor,Selector selector,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) {
    Tracer trace=Trace.trace("String_Node_Str",Trace.param("String_Node_Str",table));
    IdentityHashMap<Client,List<Selector>> map=new IdentityHashMap<Client,List<Selector>>();
    final IdentityHashMap<Selector,Integer> indexMap=new IdentityHashMap<Selector,Integer>();
    for (int i=0; i < results.results.size(); i++) {
      final LazyBlurResult result=(LazyBlurResult)results.results.get(i);
      Client client=result.getClient();
      Selector s=new Selector(selector);
      s.setLocationId(result.locationId);
      List<Selector> list=map.get(client);
      if (list == null) {
        list=new ArrayList<Selector>();
        map.put(client,list);
      }
      list.add(s);
      indexMap.put(s,i);
    }
    List<Future<Boolean>> futures=new ArrayList<Future<Boolean>>();
    final AtomicReferenceArray<FetchResult> fetchResults=new AtomicReferenceArray<FetchResult>(results.results.size());
    for (    Entry<Client,List<Selector>> entry : map.entrySet()) {
      final Client client=entry.getKey();
      final List<Selector> list=entry.getValue();
      futures.add(executor.submit(new Callable<Boolean>(){
        @Override public Boolean call() throws Exception {
          String traceId=Trace.getTraceId();
          if (traceId != null) {
            client.startTrace(traceId);
          }
          List<FetchResult> fetchRowBatch=client.fetchRowBatch(table,list);
          for (int i=0; i < list.size(); i++) {
            int index=indexMap.get(list.get(i));
            fetchResults.set(index,fetchRowBatch.get(i));
          }
          return Boolean.TRUE;
        }
      }
));
    }
    for (    Future<Boolean> future : futures) {
      future.get();
    }
    for (int i=0; i < fetchResults.length(); i++) {
      FetchResult fetchResult=fetchResults.get(i);
      BlurResult result=results.results.get(i);
      result.setFetchResult(fetchResult);
      result.setLocationId(null);
    }
    trace.done();
  }
  results.query=query;
  results.query.selector=selector;
  return results;
}

Fixed version (ground truth):
public BlurResults convertToBlurResults(BlurResultIterable hitsIterable,BlurQuery query,AtomicLongArray facetCounts,ExecutorService executor,Selector selector,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) {
    Tracer trace=Trace.trace("String_Node_Str",Trace.param("String_Node_Str",table));
    IdentityHashMap<Client,List<Selector>> map=new IdentityHashMap<Client,List<Selector>>();
    final IdentityHashMap<Selector,Integer> indexMap=new IdentityHashMap<Selector,Integer>();
    for (int i=0; i < results.results.size(); i++) {
      final LazyBlurResult result=(LazyBlurResult)results.results.get(i);
      Client client=result.getClient();
      Selector s=new Selector(selector);
      s.setLocationId(result.locationId);
      List<Selector> list=map.get(client);
      if (list == null) {
        list=new ArrayList<Selector>();
        map.put(client,list);
      }
      list.add(s);
      indexMap.put(s,i);
    }
    List<Future<Boolean>> futures=new ArrayList<Future<Boolean>>();
    final AtomicReferenceArray<FetchResult> fetchResults=new AtomicReferenceArray<FetchResult>(results.results.size());
    for (    Entry<Client,List<Selector>> entry : map.entrySet()) {
      final Client client=entry.getKey();
      final List<Selector> list=entry.getValue();
      futures.add(executor.submit(new Callable<Boolean>(){
        @Override public Boolean call() throws Exception {
          Tracer trace=Trace.trace("String_Node_Str",Trace.param("String_Node_Str",getNode(client)));
          try {
            String traceId=Trace.getTraceId();
            if (traceId != null) {
              client.startTrace(traceId);
            }
            List<FetchResult> fetchRowBatch=client.fetchRowBatch(table,list);
            for (int i=0; i < list.size(); i++) {
              int index=indexMap.get(list.get(i));
              fetchResults.set(index,fetchRowBatch.get(i));
            }
            return Boolean.TRUE;
          }
  finally {
            trace.done();
          }
        }
        private String getNode(        Client client){
          TProtocol inputProtocol=client.getInputProtocol();
          TTransport transport=inputProtocol.getTransport();
          if (transport instanceof TFramedTransport) {
            TFramedTransport framedTransport=(TFramedTransport)transport;
            transport=framedTransport.getTransport();
          }
          if (transport instanceof TSocket) {
            TSocket tsocket=(TSocket)transport;
            Socket socket=tsocket.getSocket();
            SocketAddress remoteSocketAddress=socket.getRemoteSocketAddress();
            return remoteSocketAddress.toString();
          }
          return "String_Node_Str";
        }
      }
));
    }
    for (    Future<Boolean> future : futures) {
      future.get();
    }
    for (int i=0; i < fetchResults.length(); i++) {
      FetchResult fetchResult=fetchResults.get(i);
      BlurResult result=results.results.get(i);
      result.setFetchResult(fetchResult);
      result.setLocationId(null);
    }
    trace.done();
  }
  results.query=query;
  results.query.selector=selector;
  return results;
}