Buggy code:
final class DocumentsWriter { final AtomicLong bytesUsed = new AtomicLong ( 0 ) ; IndexWriter writer ; Directory directory ; String segment ; private int nextDocID ; private int numDocs ; private DocumentsWriterThreadState [ ] threadStates = new DocumentsWriterThreadState [ 0 ] ; private final HashMap < Thread , DocumentsWriterThreadState > threadBindings = new HashMap < Thread , DocumentsWriterThreadState > ( ) ; boolean bufferIsFull ; private boolean aborting ; PrintStream infoStream ; int maxFieldLength = IndexWriter . DEFAULT_MAX_FIELD_LENGTH ; Similarity similarity ; private final int maxThreadStates ; private BufferedDeletes pendingDeletes = new BufferedDeletes ( false ) ; static class DocState { DocumentsWriter docWriter ; Analyzer analyzer ; int maxFieldLength ; PrintStream infoStream ; Similarity similarity ; int docID ; Document doc ; String maxTermPrefix ; public boolean testPoint ( String name ) { } public void clear ( ) { } } abstract static class DocWriter { DocumentsWriter . DocWriter next ; int docID ; abstract void finish ( ) throws IOException { } abstract void abort ( ) { } abstract long sizeInBytes ( ) { } void setNext ( DocumentsWriter . DocWriter next ) { } } DocumentsWriter . PerDocBuffer newPerDocBuffer ( ) { } class PerDocBuffer extends RAMFile { @ Override protected byte [ ] newBuffer ( int size ) { } synchronized void recycle ( ) { } } abstract static class IndexingChain { abstract DocConsumer getChain ( DocumentsWriter documentsWriter ) { } } static final DocumentsWriter . IndexingChain defaultIndexingChain = new DocumentsWriter . IndexingChain ( ) { @ Override DocConsumer getChain ( DocumentsWriter documentsWriter ) { } } ; final DocConsumer consumer ; private final IndexWriterConfig config ; private boolean closed ; private final FieldInfos fieldInfos ; private final BufferedDeletesStream bufferedDeletesStream ; private final FlushControl flushControl ; DocumentsWriter ( IndexWriterConfig config , Directory directory , IndexWriter writer , FieldInfos fieldInfos , BufferedDeletesStream bufferedDeletesStream ) throws IOException { } synchronized void deleteDocID ( int docIDUpto ) { } boolean deleteQueries ( Query ... queries ) { } boolean deleteQuery ( Query query ) { } boolean deleteTerms ( Term ... terms ) { } boolean deleteTerm ( Term term , boolean skipWait ) { } public FieldInfos getFieldInfos ( ) { } synchronized void setInfoStream ( PrintStream infoStream ) { } synchronized void setMaxFieldLength ( int maxFieldLength ) { } synchronized void setSimilarity ( Similarity similarity ) { } synchronized String getSegment ( ) { } synchronized int getNumDocs ( ) { } void message ( String message ) { } synchronized void setAborting ( ) { } synchronized void abort ( ) throws IOException { } private void doAfterFlush ( ) throws IOException { } private synchronized boolean allThreadsIdle ( ) { } synchronized boolean anyChanges ( ) { } public BufferedDeletes getPendingDeletes ( ) { } private void pushDeletes ( SegmentInfo newSegment , SegmentInfos segmentInfos ) { final long delGen = bufferedDeletesStream . getNextGen ( ) ; if ( pendingDeletes . any ( ) ) { if ( ( ( segmentInfos . size ( ) ) > 0 ) || ( newSegment != null ) ) { final FrozenBufferedDeletes packet = new FrozenBufferedDeletes ( pendingDeletes , delGen ) ; if ( ( infoStream ) != null ) { <START_BUG> message ( "flush:<seq2seq4repair_space>push<seq2seq4repair_space>buffered<seq2seq4repair_space>deletes" ) ; <END_BUG> } bufferedDeletesStream . push ( packet ) ; if ( ( infoStream ) != null ) { message ( ( "flush:<seq2seq4repair_space>delGen=" + ( packet . gen ) ) ) ; } if ( newSegment != null ) { newSegment . setBufferedDeletesGen ( packet . gen ) ; } } else { if ( ( infoStream ) != null ) { message ( "flush:<seq2seq4repair_space>drop<seq2seq4repair_space>buffered<seq2seq4repair_space>deletes:<seq2seq4repair_space>no<seq2seq4repair_space>segments" ) ; } } pendingDeletes . clear ( ) ; } else if ( newSegment != null ) { newSegment . setBufferedDeletesGen ( delGen ) ; } } public boolean anyDeletions ( ) { } synchronized SegmentInfo flush ( IndexWriter writer , IndexFileDeleter deleter , MergePolicy mergePolicy , SegmentInfos segmentInfos ) throws IOException { } synchronized void close ( ) { } synchronized DocumentsWriterThreadState getThreadState ( Document doc , Term delTerm ) throws IOException { } boolean addDocument ( Document doc , Analyzer analyzer ) throws IOException , CorruptIndexException { } boolean updateDocument ( Document doc , Analyzer analyzer , Term delTerm ) throws IOException , CorruptIndexException { } public synchronized void waitIdle ( ) { } synchronized void waitReady ( DocumentsWriterThreadState state ) { } private void finishDocument ( DocumentsWriterThreadState perThread , DocumentsWriter . DocWriter docWriter ) throws IOException { } synchronized void waitForWaitQueue ( ) { } private static class SkipDocWriter extends DocumentsWriter . DocWriter { @ Override void finish ( ) { } @ Override void abort ( ) { } @ Override long sizeInBytes ( ) { } } final DocumentsWriter . SkipDocWriter skipDocWriter = new DocumentsWriter . SkipDocWriter ( ) ; NumberFormat nf = NumberFormat . getInstance ( ) ; static final int BYTE_BLOCK_SHIFT = 15 ; static final int BYTE_BLOCK_SIZE = 1 << ( DocumentsWriter . BYTE_BLOCK_SHIFT ) ; static final int BYTE_BLOCK_MASK = ( DocumentsWriter . BYTE_BLOCK_SIZE ) - 1 ; static final int BYTE_BLOCK_NOT_MASK = ~ ( DocumentsWriter . BYTE_BLOCK_MASK ) ; private class ByteBlockAllocator extends ByteBlockPool . Allocator { final int blockSize ; ByteBlockAllocator ( int blockSize ) { } ArrayList < byte [ ] > freeByteBlocks = new ArrayList < byte [ ] > ( ) ; @ Override byte [ ] getByteBlock ( ) { } @ Override void recycleByteBlocks ( byte [ ] [ ] blocks , int start , int end ) { } @ Override void recycleByteBlocks ( List < byte [ ] > blocks ) { } } static final int INT_BLOCK_SHIFT = 13 ; static final int INT_BLOCK_SIZE = 1 << ( DocumentsWriter . INT_BLOCK_SHIFT ) ; static final int INT_BLOCK_MASK = ( DocumentsWriter . INT_BLOCK_SIZE ) - 1 ; private List < int [ ] > freeIntBlocks = new ArrayList < int [ ] > ( ) ; synchronized int [ ] getIntBlock ( ) { }

Fix:
message ( ( ( ( "flush:<seq2seq4repair_space>push<seq2seq4repair_space>buffered<seq2seq4repair_space>deletes<seq2seq4repair_space>startSize=" + ( pendingDeletes . bytesUsed . get ( ) ) ) + "<seq2seq4repair_space>frozenSize=" ) + ( packet . bytesUsed ) ) ) ;