Program: 113052
Project: 113052
Buggy source:
@Override public <T>CloseableIterator<T> query(final QueryOptions queryOptions,final Query query){
  final List<CloseableIterator<Object>> results=new ArrayList<CloseableIterator<Object>>();
  final QueryOptions sanitizedQueryOptions=(queryOptions == null) ? new QueryOptions() : queryOptions;
  final Query sanitizedQuery=(query == null) ? new EverythingQuery() : query;
  final DedupeFilter filter=new DedupeFilter();
  MemoryAdapterStore tempAdapterStore;
  try {
    tempAdapterStore=new MemoryAdapterStore(sanitizedQueryOptions.getAdaptersArray(adapterStore));
    for (    final Pair<PrimaryIndex,List<DataAdapter<Object>>> indexAdapterPair : sanitizedQueryOptions.getAdaptersWithMinimalSetOfIndices(tempAdapterStore,indexMappingStore,indexStore)) {
      final List<ByteArrayId> adapterIdsToQuery=new ArrayList<ByteArrayId>();
      for (      final DataAdapter<Object> adapter : indexAdapterPair.getRight()) {
        if (sanitizedQuery instanceof RowIdQuery) {
          final HBaseRowIdsQuery<Object> q=new HBaseRowIdsQuery<Object>(adapter,indexAdapterPair.getLeft(),((RowIdQuery)sanitizedQuery).getRowIds(),(ScanCallback<Object>)sanitizedQueryOptions.getScanCallback(),filter,sanitizedQueryOptions.getAuthorizations());
          results.add(q.query(operations,tempAdapterStore,-1));
          continue;
        }
 else         if (sanitizedQuery instanceof DataIdQuery) {
          final DataIdQuery idQuery=(DataIdQuery)sanitizedQuery;
          if (idQuery.getAdapterId().equals(adapter.getAdapterId())) {
            results.add(getEntries(indexAdapterPair.getLeft(),idQuery.getDataIds(),(DataAdapter<Object>)adapterStore.getAdapter(idQuery.getAdapterId()),filter,(ScanCallback<Object>)sanitizedQueryOptions.getScanCallback(),sanitizedQueryOptions.getAuthorizations(),sanitizedQueryOptions.getMaxResolutionSubsamplingPerDimension(),true));
          }
          continue;
        }
 else         if (sanitizedQuery instanceof PrefixIdQuery) {
          continue;
        }
        adapterIdsToQuery.add(adapter.getAdapterId());
      }
      if (adapterIdsToQuery.size() > 0) {
        HBaseConstraintsQuery accumuloQuery;
        accumuloQuery=new HBaseConstraintsQuery(adapterIdsToQuery,indexAdapterPair.getLeft(),sanitizedQuery,filter,sanitizedQueryOptions.getScanCallback(),queryOptions.getAggregation(),sanitizedQueryOptions.getAuthorizations());
        results.add(accumuloQuery.query(operations,tempAdapterStore,sanitizedQueryOptions.getLimit()));
      }
    }
  }
 catch (  final IOException e1) {
    LOGGER.error("String_Node_Str",e1);
  }
  return new CloseableIteratorWrapper<T>(new Closeable(){
    @Override public void close() throws IOException {
      for (      final CloseableIterator<Object> result : results) {
        result.close();
      }
    }
  }
,Iterators.concat(new CastIterator<T>(results.iterator())));
}

Fixed version (ground truth):
@Override public <T>CloseableIterator<T> query(final QueryOptions queryOptions,final Query query){
  final List<CloseableIterator<Object>> results=new ArrayList<CloseableIterator<Object>>();
  final QueryOptions sanitizedQueryOptions=(queryOptions == null) ? new QueryOptions() : queryOptions;
  final Query sanitizedQuery=(query == null) ? new EverythingQuery() : query;
  final DedupeFilter filter=new DedupeFilter();
  MemoryAdapterStore tempAdapterStore;
  try {
    tempAdapterStore=new MemoryAdapterStore(sanitizedQueryOptions.getAdaptersArray(adapterStore));
    for (    final Pair<PrimaryIndex,List<DataAdapter<Object>>> indexAdapterPair : sanitizedQueryOptions.getAdaptersWithMinimalSetOfIndices(tempAdapterStore,indexMappingStore,indexStore)) {
      final List<ByteArrayId> adapterIdsToQuery=new ArrayList<ByteArrayId>();
      for (      final DataAdapter<Object> adapter : indexAdapterPair.getRight()) {
        if (sanitizedQuery instanceof RowIdQuery) {
          final HBaseRowIdsQuery<Object> q=new HBaseRowIdsQuery<Object>(adapter,indexAdapterPair.getLeft(),((RowIdQuery)sanitizedQuery).getRowIds(),(ScanCallback<Object>)sanitizedQueryOptions.getScanCallback(),filter,sanitizedQueryOptions.getAuthorizations());
          results.add(q.query(operations,tempAdapterStore,-1));
          continue;
        }
 else         if (sanitizedQuery instanceof DataIdQuery) {
          final DataIdQuery idQuery=(DataIdQuery)sanitizedQuery;
          if (idQuery.getAdapterId().equals(adapter.getAdapterId())) {
            results.add(getEntries(indexAdapterPair.getLeft(),idQuery.getDataIds(),(DataAdapter<Object>)adapterStore.getAdapter(idQuery.getAdapterId()),filter,(ScanCallback<Object>)sanitizedQueryOptions.getScanCallback(),sanitizedQueryOptions.getAuthorizations(),sanitizedQueryOptions.getMaxResolutionSubsamplingPerDimension(),true));
          }
          continue;
        }
 else         if (sanitizedQuery instanceof PrefixIdQuery) {
          continue;
        }
        adapterIdsToQuery.add(adapter.getAdapterId());
      }
      if (adapterIdsToQuery.size() > 0) {
        HBaseConstraintsQuery hbaseQuery;
        hbaseQuery=new HBaseConstraintsQuery(adapterIdsToQuery,indexAdapterPair.getLeft(),sanitizedQuery,filter,sanitizedQueryOptions.getScanCallback(),queryOptions.getAggregation(),sanitizedQueryOptions.getAuthorizations());
        results.add(hbaseQuery.query(operations,tempAdapterStore,sanitizedQueryOptions.getLimit()));
      }
    }
  }
 catch (  final IOException e1) {
    LOGGER.error("String_Node_Str",e1);
  }
  return new CloseableIteratorWrapper<T>(new Closeable(){
    @Override public void close() throws IOException {
      for (      final CloseableIterator<Object> result : results) {
        result.close();
      }
    }
  }
,Iterators.concat(new CastIterator<T>(results.iterator())));
}