Buggy code:
class MultiSegmentReader extends DirectoryIndexReader { protected SegmentReader [ ] subReaders ; private int [ ] starts ; private Map normsCache = new HashMap ( ) ; private int maxDoc = 0 ; private int numDocs = - 1 ; private boolean hasDeletions = false ; MultiSegmentReader ( Directory directory , SegmentInfos sis , boolean closeDirectory , boolean readOnly ) throws IOException { } MultiSegmentReader ( Directory directory , SegmentInfos infos , boolean closeDirectory , SegmentReader [ ] oldReaders , int [ ] oldStarts , Map oldNormsCache , boolean readOnly ) throws IOException { } private void initialize ( SegmentReader [ ] subReaders ) { } protected synchronized DirectoryIndexReader doReopen ( SegmentInfos infos ) throws IOException , CorruptIndexException { } public TermFreqVector [ ] getTermFreqVectors ( int n ) throws IOException { } public TermFreqVector getTermFreqVector ( int n , String field ) throws IOException { } public void getTermFreqVector ( int docNumber , String field , TermVectorMapper mapper ) throws IOException { } public void getTermFreqVector ( int docNumber , TermVectorMapper mapper ) throws IOException { } public boolean isOptimized ( ) { } public synchronized int numDocs ( ) { } public int maxDoc ( ) { } public Document document ( int n , FieldSelector fieldSelector ) throws IOException , CorruptIndexException { } public boolean isDeleted ( int n ) { } public boolean hasDeletions ( ) { } protected void doDelete ( int n ) throws IOException , CorruptIndexException { } protected void doUndeleteAll ( ) throws IOException , CorruptIndexException { } private int readerIndex ( int n ) { } static final int readerIndex ( int n , int [ ] starts , int numSubReaders ) { int lo = 0 ; int hi = numSubReaders - 1 ; while ( hi >= lo ) { <START_BUG> int mid = ( lo + hi ) > > 1 ; <END_BUG> int midValue = starts [ mid ] ; if ( n < midValue ) hi = mid - 1 ; else if ( n > midValue ) lo = mid + 1 ; else { while ( ( ( mid + 1 ) < numSubReaders ) && ( ( starts [ ( mid + 1 ) ] ) == midValue ) ) { mid ++ ; } return mid ; } } return hi ; } public boolean hasNorms ( String field ) throws IOException { } private byte [ ] ones ; private byte [ ] fakeNorms ( ) { } public synchronized byte [ ] norms ( String field ) throws IOException { } public synchronized void norms ( String field , byte [ ] result , int offset ) throws IOException { } protected void doSetNorm ( int n , String field , byte value ) throws IOException , CorruptIndexException { } public TermEnum terms ( ) throws IOException { } public TermEnum terms ( Term term ) throws IOException { } public int docFreq ( Term t ) throws IOException { } public TermDocs termDocs ( ) throws IOException { } public TermPositions termPositions ( ) throws IOException { } protected void commitChanges ( ) throws IOException { } void startCommit ( ) { } void rollbackCommit ( ) { } protected synchronized void doClose ( ) throws IOException { } public Collection getFieldNames ( IndexReader . FieldOption fieldNames ) { } static Collection getFieldNames ( IndexReader . FieldOption fieldNames , IndexReader [ ] subReaders ) { } SegmentReader [ ] getSubReaders ( ) { } public void setTermInfosIndexDivisor ( int indexDivisor ) throws IllegalStateException { } public int getTermInfosIndexDivisor ( ) throws IllegalStateException { } static class MultiTermEnum extends TermEnum { private SegmentMergeQueue queue ; private Term term ; private int docFreq ; public MultiTermEnum ( IndexReader [ ] readers , int [ ] starts , Term t ) throws IOException { } public boolean next ( ) throws IOException { } public Term term ( ) { } public int docFreq ( ) { } public void close ( ) throws IOException { } } static class MultiTermDocs implements TermDocs { protected IndexReader [ ] readers ; protected int [ ] starts ; protected Term term ; protected int base = 0 ; protected int pointer = 0 ; private TermDocs [ ] readerTermDocs ; protected TermDocs current ; public MultiTermDocs ( IndexReader [ ] r , int [ ] s ) { } public int doc ( ) { } public int freq ( ) { } public void seek ( Term term ) { } public void seek ( TermEnum termEnum ) throws IOException { } public boolean next ( ) throws IOException { } public int read ( final int [ ] docs , final int [ ] freqs ) throws IOException { } public boolean skipTo ( int target ) throws IOException { } private TermDocs termDocs ( int i ) throws IOException { } protected TermDocs termDocs ( IndexReader reader ) throws IOException { } public void close ( ) throws IOException { } } static class MultiTermPositions extends MultiSegmentReader . MultiTermDocs implements TermPositions { public MultiTermPositions ( IndexReader [ ] r , int [ ] s ) { } protected TermDocs termDocs ( IndexReader reader ) throws IOException { } public int nextPosition ( ) throws IOException { } public int getPayloadLength ( ) { } public byte [ ] getPayload ( byte [ ] data , int offset ) throws IOException { } public boolean isPayloadAvailable ( ) { } } }

Fix:
int mid = ( lo + hi ) > > > 1 ;