Program: 113162
Project: 113162
Buggy source:
@Override public RangeDecomposition decomposeRange(final NumericData[] rangePerDimension,final CompactHilbertCurve compactHilbertCurve,final SFCDimensionDefinition[] dimensionDefinitions,final int totalPrecision,final int maxFilteredIndexedRanges,final boolean removeVacuum){
  final List<Long> minRangeList=new ArrayList<Long>();
  final List<Long> maxRangeList=new ArrayList<Long>();
  final LongContent zero=new LongContent(0L);
  final List<LongRange> region=new ArrayList<LongRange>(dimensionDefinitions.length);
  for (int d=0; d < dimensionDefinitions.length; d++) {
    final long normalizedMin=normalizeDimension(dimensionDefinitions[d],rangePerDimension[d].getMin(),binsPerDimension[d]);
    final long normalizedMax=normalizeDimension(dimensionDefinitions[d],rangePerDimension[d].getMax(),binsPerDimension[d]);
    minRangeList.add(normalizedMin);
    maxRangeList.add(normalizedMax);
    region.add(LongRange.of(normalizedMin,normalizedMax + 1L));
  }
  final long minQuadSize=getMinimumQuadSize(minRangeList,maxRangeList);
  final RegionInspector<LongRange,LongContent> regionInspector=SimpleRegionInspector.create(ImmutableList.of(region),new LongContent(minQuadSize),Functions.<LongRange>identity(),LongRangeHome.INSTANCE,zero);
  final PlainFilterCombiner<LongRange,Long,LongContent,LongRange> intervalCombiner=new PlainFilterCombiner<LongRange,Long,LongContent,LongRange>(LongRange.of(0,1));
  final QueryBuilder<LongRange,LongRange> queryBuilder=BacktrackingQueryBuilder.create(regionInspector,intervalCombiner,maxFilteredIndexedRanges,removeVacuum,LongRangeHome.INSTANCE,zero);
  compactHilbertCurve.accept(new ZoomingSpaceVisitorAdapter(compactHilbertCurve,queryBuilder));
  final List<FilteredIndexRange<LongRange,LongRange>> hilbertRanges=queryBuilder.get().getFilteredIndexRanges();
  final ByteArrayRange[] sfcRanges=new ByteArrayRange[hilbertRanges.size()];
  final int expectedByteCount=(int)Math.ceil(totalPrecision / 8.0);
  if (expectedByteCount <= 0) {
    return new RangeDecomposition(new ByteArrayRange[]{new ByteArrayRange(new ByteArrayId(new byte[]{}),new ByteArrayId(new byte[]{}))});
  }
  for (int i=0; i < hilbertRanges.size(); i++) {
    final FilteredIndexRange<LongRange,LongRange> range=hilbertRanges.get(i);
    final byte[] start=HilbertSFC.fitExpectedByteCount(expectedByteCount,ByteBuffer.allocate(8).putLong(range.getIndexRange().getStart()).array());
    final byte[] end=HilbertSFC.fitExpectedByteCount(expectedByteCount,ByteBuffer.allocate(8).putLong(range.getIndexRange().getEnd()).array());
    sfcRanges[i]=new ByteArrayRange(new ByteArrayId(start),new ByteArrayId(end));
  }
  final RangeDecomposition rangeDecomposition=new RangeDecomposition(sfcRanges);
  return rangeDecomposition;
}

Fixed version (ground truth):
@Override public RangeDecomposition decomposeRange(final NumericData[] rangePerDimension,final CompactHilbertCurve compactHilbertCurve,final SFCDimensionDefinition[] dimensionDefinitions,final int totalPrecision,final int maxFilteredIndexedRanges,final boolean removeVacuum){
  final List<Long> minRangeList=new ArrayList<Long>();
  final List<Long> maxRangeList=new ArrayList<Long>();
  final LongContent zero=new LongContent(0L);
  final List<LongRange> region=new ArrayList<LongRange>(dimensionDefinitions.length);
  for (int d=0; d < dimensionDefinitions.length; d++) {
    final long normalizedMin=normalizeDimension(dimensionDefinitions[d],rangePerDimension[d].getMin(),binsPerDimension[d]);
    final long normalizedMax=normalizeDimension(dimensionDefinitions[d],rangePerDimension[d].getMax(),binsPerDimension[d]);
    minRangeList.add(normalizedMin);
    maxRangeList.add(normalizedMax);
    region.add(LongRange.of(normalizedMin,normalizedMax + 1L));
  }
  final long minQuadSize=getMinimumQuadSize(minRangeList,maxRangeList);
  final RegionInspector<LongRange,LongContent> regionInspector=SimpleRegionInspector.create(ImmutableList.of(region),new LongContent(minQuadSize),Functions.<LongRange>identity(),LongRangeHome.INSTANCE,zero);
  final PlainFilterCombiner<LongRange,Long,LongContent,LongRange> intervalCombiner=new PlainFilterCombiner<LongRange,Long,LongContent,LongRange>(LongRange.of(0,1));
  final QueryBuilder<LongRange,LongRange> queryBuilder=BacktrackingQueryBuilder.create(regionInspector,intervalCombiner,maxFilteredIndexedRanges,removeVacuum,LongRangeHome.INSTANCE,zero);
  compactHilbertCurve.accept(new ZoomingSpaceVisitorAdapter(compactHilbertCurve,queryBuilder));
  final List<FilteredIndexRange<LongRange,LongRange>> hilbertRanges=queryBuilder.get().getFilteredIndexRanges();
  final ByteArrayRange[] sfcRanges=new ByteArrayRange[hilbertRanges.size()];
  final int expectedByteCount=(int)Math.ceil(totalPrecision / 8.0);
  if (expectedByteCount <= 0) {
    return new RangeDecomposition(new ByteArrayRange[]{new ByteArrayRange(new ByteArrayId(new byte[]{}),new ByteArrayId(new byte[]{}))});
  }
  for (int i=0; i < hilbertRanges.size(); i++) {
    final FilteredIndexRange<LongRange,LongRange> range=hilbertRanges.get(i);
    final long startValue=clamp(minHilbertValue,maxHilbertValue,range.getIndexRange().getStart());
    final long endValue=clamp(minHilbertValue,maxHilbertValue,range.getIndexRange().getEnd());
    final byte[] start=HilbertSFC.fitExpectedByteCount(expectedByteCount,ByteBuffer.allocate(8).putLong(startValue).array());
    final byte[] end=HilbertSFC.fitExpectedByteCount(expectedByteCount,ByteBuffer.allocate(8).putLong(endValue).array());
    sfcRanges[i]=new ByteArrayRange(new ByteArrayId(start),new ByteArrayId(end));
  }
  final RangeDecomposition rangeDecomposition=new RangeDecomposition(sfcRanges);
  return rangeDecomposition;
}