Buggy code:
class DirectoryReader extends IndexReader implements Cloneable { protected Directory directory ; protected boolean readOnly ; protected CodecProvider codecs ; IndexWriter writer ; private IndexDeletionPolicy deletionPolicy ; private Lock writeLock ; private final SegmentInfos segmentInfos ; private boolean stale ; private final int termInfosIndexDivisor ; private boolean rollbackHasChanges ; private SegmentReader [ ] subReaders ; private ReaderContext topLevelReaderContext ; private int [ ] starts ; private int maxDoc = 0 ; private int numDocs = - 1 ; private boolean hasDeletions = false ; private long maxIndexVersion ; private final boolean applyAllDeletes ; static IndexReader open ( final Directory directory , final IndexDeletionPolicy deletionPolicy , final IndexCommit commit , final boolean readOnly , final int termInfosIndexDivisor , CodecProvider codecs ) throws IOException , CorruptIndexException { } DirectoryReader ( Directory directory , SegmentInfos sis , IndexDeletionPolicy deletionPolicy , boolean readOnly , int termInfosIndexDivisor , CodecProvider codecs ) throws IOException { } DirectoryReader ( IndexWriter writer , SegmentInfos infos , CodecProvider codecs , boolean applyAllDeletes ) throws IOException { } DirectoryReader ( Directory directory , SegmentInfos infos , SegmentReader [ ] oldReaders , int [ ] oldStarts , boolean readOnly , boolean doClone , int termInfosIndexDivisor , CodecProvider codecs , Collection < ReaderFinishedListener > readerFinishedListeners ) throws IOException { } @ Override public String toString ( ) { final StringBuilder buffer = new StringBuilder ( ) ; if ( hasChanges ) { buffer . append ( "*" ) ; } buffer . append ( getClass ( ) . getSimpleName ( ) ) ; buffer . append ( '(' ) ; final String segmentsFile = segmentInfos . getCurrentSegmentFileName ( ) ; if ( segmentsFile != null ) { <START_BUG> buffer . append ( segmentsFile ) ; <END_BUG> } if ( ( writer ) != null ) { buffer . append ( ":nrt" ) ; } for ( int i = 0 ; i < ( subReaders . length ) ; i ++ ) { buffer . append ( '<seq2seq4repair_space>' ) ; buffer . append ( subReaders [ i ] ) ; } buffer . append ( ')' ) ; return buffer . toString ( ) ; } private void initialize ( SegmentReader [ ] subReaders ) throws IOException { } @ Override public Bits getLiveDocs ( ) { } @ Override public final synchronized Object clone ( ) { } @ Override public final synchronized IndexReader clone ( boolean openReadOnly ) throws IOException , CorruptIndexException { } @ Override public final IndexReader reopen ( ) throws IOException , CorruptIndexException { } @ Override public final IndexReader reopen ( boolean openReadOnly ) throws IOException , CorruptIndexException { } @ Override public final IndexReader reopen ( final IndexCommit commit ) throws IOException , CorruptIndexException { } private final IndexReader doReopenFromWriter ( boolean openReadOnly , IndexCommit commit ) throws IOException , CorruptIndexException { } private IndexReader doReopen ( final boolean openReadOnly , IndexCommit commit ) throws IOException , CorruptIndexException { } private synchronized IndexReader doReopenNoWriter ( final boolean openReadOnly , IndexCommit commit ) throws IOException , CorruptIndexException { } private synchronized DirectoryReader doReopen ( SegmentInfos infos , boolean doClone , boolean openReadOnly ) throws IOException , CorruptIndexException { } @ Override public long getVersion ( ) { } @ Override public TermFreqVector [ ] getTermFreqVectors ( int n ) throws IOException { } @ Override public TermFreqVector getTermFreqVector ( int n , String field ) throws IOException { } @ Override public void getTermFreqVector ( int docNumber , String field , TermVectorMapper mapper ) throws IOException { } @ Override public void getTermFreqVector ( int docNumber , TermVectorMapper mapper ) throws IOException { } @ Override public boolean isOptimized ( ) { } @ Override public int numDocs ( ) { } @ Override public int maxDoc ( ) { } @ Override public Document document ( int n , FieldSelector fieldSelector ) throws IOException , CorruptIndexException { } @ Override public boolean hasDeletions ( ) { } @ Override protected void doDelete ( int n ) throws IOException , CorruptIndexException { } @ Override protected void doUndeleteAll ( ) throws IOException , CorruptIndexException { } private int readerIndex ( int n ) { } static final int readerIndex ( int n , int [ ] starts , int numSubReaders ) { } @ Override public boolean hasNorms ( String field ) throws IOException { } @ Override public synchronized byte [ ] norms ( String field ) throws IOException { } @ Override protected void doSetNorm ( int n , String field , byte value ) throws IOException , CorruptIndexException { } @ Override public int docFreq ( Term t ) throws IOException { } @ Override public int docFreq ( String field , BytesRef term ) throws IOException { } @ Override public Fields fields ( ) throws IOException { } @ Override protected void acquireWriteLock ( ) throws IOException , CorruptIndexException , StaleReaderException , LockObtainFailedException { } @ Override protected void doCommit ( Map < String , String > commitUserData ) throws IOException { } void startCommit ( ) { } void rollbackCommit ( ) { } @ Override public long getUniqueTermCount ( ) throws IOException { } @ Override public Map < String , String > getCommitUserData ( ) { } @ Override public boolean isCurrent ( ) throws IOException , CorruptIndexException { } @ Override protected synchronized void doClose ( ) throws IOException { } @ Override public Collection < String > getFieldNames ( IndexReader . FieldOption fieldNames ) { } static Collection < String > getFieldNames ( IndexReader . FieldOption fieldNames , IndexReader [ ] subReaders ) { } @ Override public ReaderContext getTopReaderContext ( ) { } @ Override public IndexReader [ ] getSequentialSubReaders ( ) { } @ Override public Directory directory ( ) { } @ Override public int getTermInfosIndexDivisor ( ) { } @ Override public IndexCommit getIndexCommit ( ) throws IOException { } public static List < IndexCommit > listCommits ( Directory dir ) throws IOException { }

Fix:
buffer . append ( segmentsFile ) . append ( ":" ) . append ( segmentInfos . getVersion ( ) ) ;