Buggy code:
public class Buckets { private Buckets . IBuckets m_data ; public Buckets ( final int size , final boolean isLong ) { } public boolean isLong ( ) { } public void set ( final int index , final long value ) { } public void set ( final int index , final int blockIdx , final int offset , final int length ) { m_data . set ( index , blockIdx , offset , length ) ; } public long get ( final int index ) { } public boolean select ( final int index ) { } public int length ( ) { } public int getOffset ( ) { } public int getBlockIndex ( ) { } public int getBlockLength ( ) { } public long getBucket ( ) { } public long emptyBucket ( ) { } public int maxEncodedLength ( ) { } public int getBlockSize ( final int allocatorMapSize ) { } private interface IBuckets { public boolean isLong ( ) { } public void set ( final int index , final long value ) { } public void set ( final int index , final int blockIdx , final int offset , final int length ) ; public long get ( final int index ) { } public boolean select ( final int index ) { } public int length ( ) { } public int getOffset ( ) { } public int getBlockIndex ( ) { } public int getBlockLength ( ) { } public long getBucket ( ) { } public int maxEncodedLength ( ) { } public int getBlockSize ( final int allocatorMapSize ) { } } private class IntBucket implements Buckets . IBuckets { private final int [ ] m_data ; private int m_bucket ; public IntBucket ( final int size ) { } @ Override public boolean isLong ( ) { } @ Override public void set ( final int index , final long value ) { } @ Override public void set ( final int index , final int blockIdx , final int offset , final int length ) { <START_BUG> if ( blockIdx > ( IntBucketEncoding . MAX_BLOCK_INDEX ) ) { <END_BUG> final Buckets . LongBucket longBucket = new Buckets . LongBucket ( m_data . length ) ; for ( int i = 0 ; i < ( m_data . length ) ; ++ i ) if ( select ( i ) ) { final int blockLength = getBlockLength ( ) ; longBucket . set ( i , getBlockIndex ( ) , getOffset ( ) , ( blockLength != ( maxEncodedLength ( ) ) ? blockLength : longBucket . maxEncodedLength ( ) ) ) ; } longBucket . set ( index , blockIdx , offset , ( length < ( IntBucketEncoding . MAX_ENCODED_LENGTH ) ? length : LongBucketEncoding . MAX_ENCODED_LENGTH ) ) ; Buckets . this . m_data = longBucket ; } else m_data [ index ] = IntBucketEncoding . pack ( blockIdx , offset , length ) ; } @ Override public long get ( final int index ) { } @ Override public boolean select ( final int index ) { } @ Override public int length ( ) { } @ Override public int getOffset ( ) { } @ Override public int getBlockIndex ( ) { } @ Override public int getBlockLength ( ) { } @ Override public long getBucket ( ) { } @ Override public int maxEncodedLength ( ) { } @ Override public int getBlockSize ( final int allocatorMapSize ) { } } private class LongBucket implements Buckets . IBuckets { private final long [ ] m_data ; private long m_bucket ; public LongBucket ( final int size ) { } @ Override public boolean isLong ( ) { } @ Override public void set ( final int index , final long value ) { } @ Override public void set ( final int index , final int blockIdx , final int offset , final int length ) { m_data [ index ] = LongBucketEncoding . pack ( blockIdx , offset , length ) ; } @ Override public long get ( final int index ) { } @ Override public boolean select ( final int index ) { } @ Override public int length ( ) { } @ Override public int getOffset ( ) { } @ Override public int getBlockIndex ( ) { } @ Override public int getBlockLength ( ) { } @ Override public long getBucket ( ) { } @ Override public int maxEncodedLength ( ) { } @ Override public int getBlockSize ( final int allocatorMapSize ) { } } }

Fix:
if ( ( blockIdx > ( IntBucketEncoding . MAX_BLOCK_INDEX ) ) || ( offset >= ( IntBucketEncoding . MAX_BLOCK_SIZE ) ) ) {