Program: 112887
Project: 112887
Buggy source:
@Override public CloseableIterator<GeoWaveMetadata> query(final MetadataQuery query){
  final Scan scanner=new Scan();
  try {
    final byte[] columnFamily=StringUtils.stringToBinary(metadataType.name());
    final byte[] columnQualifier=query.getSecondaryId();
    if (columnFamily != null) {
      if (columnQualifier != null) {
        scanner.addColumn(columnFamily,columnQualifier);
      }
 else {
        scanner.addFamily(columnFamily);
      }
    }
    if (query.hasPrimaryId()) {
      scanner.setStartRow(query.getPrimaryId());
      scanner.setStopRow(query.getPrimaryId());
    }
    final boolean clientsideStatsMerge=(metadataType == MetadataType.STATS) && !options.isServerSideLibraryEnabled();
    if (clientsideStatsMerge) {
      scanner.setMaxVersions();
    }
    final ResultScanner rS=operations.getScannedResults(scanner,AbstractGeoWavePersistence.METADATA_TABLE,query.getAuthorizations());
    final Iterator<Result> it=rS.iterator();
    return new CloseableIteratorWrapper<>(new ScannerClosableWrapper(rS),Iterators.transform(it,new com.google.common.base.Function<Result,GeoWaveMetadata>(){
      @Override public GeoWaveMetadata apply(      final Result result){
        return new GeoWaveMetadata(result.getRow(),columnQualifier,null,getMergedStats(result,clientsideStatsMerge));
      }
    }
));
  }
 catch (  final Exception e) {
    LOGGER.warn("String_Node_Str",e);
  }
  return new CloseableIterator.Wrapper<>(Iterators.emptyIterator());
}

Fixed version (ground truth):
@Override public CloseableIterator<GeoWaveMetadata> query(final MetadataQuery query){
  final Scan scanner=new Scan();
  try {
    final byte[] columnFamily=StringUtils.stringToBinary(metadataType.name());
    final byte[] columnQualifier=query.getSecondaryId();
    if (columnQualifier != null) {
      scanner.addColumn(columnFamily,columnQualifier);
    }
 else {
      scanner.addFamily(columnFamily);
    }
    if (query.hasPrimaryId()) {
      scanner.setStartRow(query.getPrimaryId());
      scanner.setStopRow(query.getPrimaryId());
    }
    final boolean clientsideStatsMerge=(metadataType == MetadataType.STATS) && !options.isServerSideLibraryEnabled();
    if (clientsideStatsMerge) {
      scanner.setMaxVersions();
    }
    final ResultScanner rS=operations.getScannedResults(scanner,AbstractGeoWavePersistence.METADATA_TABLE,query.getAuthorizations());
    final Iterator<Result> it=rS.iterator();
    return new CloseableIteratorWrapper<>(new ScannerClosableWrapper(rS),Iterators.transform(it,new com.google.common.base.Function<Result,GeoWaveMetadata>(){
      @Override public GeoWaveMetadata apply(      final Result result){
        byte[] resultantCQ;
        if (columnQualifier == null) {
          NavigableMap<byte[],byte[]> familyMap=result.getFamilyMap(columnFamily);
          if (familyMap != null && !familyMap.isEmpty()) {
            resultantCQ=familyMap.firstKey();
          }
 else {
            resultantCQ=new byte[0];
          }
        }
 else {
          resultantCQ=columnQualifier;
        }
        return new GeoWaveMetadata(result.getRow(),resultantCQ,null,getMergedStats(result,clientsideStatsMerge));
      }
    }
));
  }
 catch (  final Exception e) {
    LOGGER.warn("String_Node_Str",e);
  }
  return new CloseableIterator.Wrapper<>(Iterators.emptyIterator());
}