Buggy code:
public void optimize ( int maxNumSegments , boolean doWait ) throws IOException , CorruptIndexException { } private synchronized boolean optimizeMergesPending ( ) { } public void expungeDeletes ( boolean doWait ) throws IOException , CorruptIndexException { } public void expungeDeletes ( ) throws IOException , CorruptIndexException { } public final void maybeMerge ( ) throws IOException , CorruptIndexException { } private final void maybeMerge ( boolean optimize ) throws IOException , CorruptIndexException { } private final void maybeMerge ( int maxNumSegmentsOptimize , boolean optimize ) throws IOException , CorruptIndexException { } private synchronized void updatePendingMerges ( int maxNumSegmentsOptimize , boolean optimize ) throws IOException , CorruptIndexException { } synchronized OneMerge getNextMerge ( ) { } public void rollback ( ) throws IOException { } private void rollbackInternal ( ) throws IOException { } public synchronized void deleteAll ( ) throws IOException { } private synchronized void finishMerges ( boolean waitForMerges ) throws IOException { } public synchronized void waitForMerges ( ) { } private synchronized void checkpoint ( ) throws IOException { } private synchronized void resetMergeExceptions ( ) { } private void noDupDirs ( Directory ... dirs ) { } public void addIndexes ( Directory ... dirs ) throws IOException , CorruptIndexException { } public void addIndexes ( IndexReader ... readers ) throws IOException , CorruptIndexException { } protected void doAfterFlush ( ) throws IOException { } protected void doBeforeFlush ( ) throws IOException { } public final void prepareCommit ( ) throws IOException , CorruptIndexException { } public final void prepareCommit ( Map < String , String > commitUserData ) throws IOException , CorruptIndexException { } private final Object commitLock = new Object ( ) ; private void commit ( long sizeInBytes ) throws IOException { } public final void commit ( ) throws IOException , CorruptIndexException { } public final void commit ( Map < String , String > commitUserData ) throws IOException , CorruptIndexException { } private final synchronized void finishCommit ( ) throws IOException , CorruptIndexException { } protected final void flush ( boolean triggerMerge , boolean flushDocStores , boolean flushDeletes ) throws IOException , CorruptIndexException { } private final synchronized boolean doFlush ( boolean flushDocStores , boolean flushDeletes ) throws IOException , CorruptIndexException { } private final synchronized boolean doFlushInternal ( boolean flushDocStores , boolean flushDeletes ) throws IOException , CorruptIndexException { } public final long ramSizeInBytes ( ) { } public final synchronized int numRamDocs ( ) { } private int ensureContiguousMerge ( MergePolicy . OneMerge merge ) { } private synchronized void commitMergedDeletes ( MergePolicy . OneMerge merge , SegmentReader mergeReader ) throws IOException { } private synchronized boolean commitMerge ( MergePolicy . OneMerge merge , SegmentMerger merger , int mergedDocCount , SegmentReader mergedReader ) throws IOException { } private synchronized void decrefMergeSegments ( MergePolicy . OneMerge merge ) throws IOException { } private final void handleMergeException ( Throwable t , MergePolicy . OneMerge merge ) throws IOException { } final void merge ( MergePolicy . OneMerge merge ) throws IOException , CorruptIndexException { boolean success = false ; final long t0 = System . currentTimeMillis ( ) ; try { try { try { mergeInit ( merge ) ; if ( ( infoStream ) != null ) message ( ( ( ( "now<seq2seq4repair_space>merge\n<seq2seq4repair_space>merge=" + ( merge . segString ( directory ) ) ) + "\n<seq2seq4repair_space>index=" ) + ( segString ( ) ) ) ) ; mergeMiddle ( merge ) ; mergeSuccess ( merge ) ; success = true ; } catch ( Throwable t ) { handleMergeException ( t , merge ) ; } } finally { synchronized ( this ) { mergeFinish ( merge ) ; if ( ! success ) { if ( ( infoStream ) != null ) message ( "hit<seq2seq4repair_space>exception<seq2seq4repair_space>during<seq2seq4repair_space>merge" ) ; if ( ( ( merge . info ) != null ) && ( ! ( segmentInfos . contains ( merge . info ) ) ) ) deleter . refresh ( merge . info . name ) ; } <START_BUG> if ( ( success && ( ! ( merge . isAborted ( ) ) ) ) && ( ( merge . optimize ) || ( ( ! ( closed ) ) && ( ! ( closing ) ) ) ) ) { <END_BUG> updatePendingMerges ( merge . maxNumSegmentsOptimize , merge . optimize ) ; } } } } catch ( OutOfMemoryError oom ) { handleOOM ( oom , "merge" ) ; } if ( ( ( infoStream ) != null ) && ( ( merge . info ) != null ) ) { message ( ( ( ( ( "merge<seq2seq4repair_space>time<seq2seq4repair_space>" + ( ( System . currentTimeMillis ( ) ) - t0 ) ) + "<seq2seq4repair_space>msec<seq2seq4repair_space>for<seq2seq4repair_space>" ) + ( merge . info . docCount ) ) + "<seq2seq4repair_space>docs" ) ) ; } } void mergeSuccess ( MergePolicy . OneMerge merge ) { } final synchronized boolean registerMerge ( MergePolicy . OneMerge merge ) throws MergeAbortedException { } final synchronized void mergeInit ( MergePolicy . OneMerge merge ) throws IOException { } private final synchronized void _mergeInit ( MergePolicy . OneMerge merge ) throws IOException { } private void setDiagnostics ( SegmentInfo info , String source ) { } private void setDiagnostics ( SegmentInfo info , String source , Map < String , String > details ) { } final synchronized void mergeFinish ( MergePolicy . OneMerge merge ) throws IOException { } private synchronized void setMergeDocStoreIsCompoundFile ( MergePolicy . OneMerge merge ) { } private final int mergeMiddle ( MergePolicy . OneMerge merge ) throws IOException , CorruptIndexException { } synchronized void addMergeException ( MergePolicy . OneMerge merge ) { } private final synchronized boolean applyDeletes ( ) throws IOException , CorruptIndexException { } final synchronized int getBufferedDeleteTermsSize ( ) { } final synchronized int getNumBufferedDeleteTerms ( ) { } SegmentInfo newestSegment ( ) { } public synchronized String segString ( ) { } private synchronized String segString ( SegmentInfos infos ) { } private synchronized void doWait ( ) { }

Fix:
if ( ( ( success && ( ! ( merge . isAborted ( ) ) ) ) && ( ! ( closed ) ) ) && ( ! ( closing ) ) ) {