Buggy code:
public class DirectUpdateHandler2 extends UpdateHandler { AtomicLong addCommands = new AtomicLong ( ) ; AtomicLong addCommandsCumulative = new AtomicLong ( ) ; AtomicLong deleteByIdCommands = new AtomicLong ( ) ; AtomicLong deleteByIdCommandsCumulative = new AtomicLong ( ) ; AtomicLong deleteByQueryCommands = new AtomicLong ( ) ; AtomicLong deleteByQueryCommandsCumulative = new AtomicLong ( ) ; AtomicLong commitCommands = new AtomicLong ( ) ; AtomicLong optimizeCommands = new AtomicLong ( ) ; AtomicLong numDocsDeleted = new AtomicLong ( ) ; AtomicLong numDocsPending = new AtomicLong ( ) ; AtomicLong numErrors = new AtomicLong ( ) ; AtomicLong numErrorsCumulative = new AtomicLong ( ) ; protected final DirectUpdateHandler2 . CommitTracker tracker ; protected final Map < String , Integer > pset ; protected static final Integer ZERO = 0 ; protected static final Integer ONE = 1 ; protected final Lock iwAccess ; protected final Lock iwCommit ; protected IndexWriter writer ; protected SolrIndexSearcher searcher ; public DirectUpdateHandler2 ( SolrCore core ) throws IOException { } protected void openWriter ( ) throws IOException { } protected void closeWriter ( ) throws IOException { } protected void openSearcher ( ) throws IOException { } protected void closeSearcher ( ) throws IOException { } public int addDoc ( AddUpdateCommand cmd ) throws IOException { } public void delete ( DeleteUpdateCommand cmd ) throws IOException { } public void deleteByQuery ( DeleteUpdateCommand cmd ) throws IOException { } protected int addConditionally ( AddUpdateCommand cmd ) throws IOException { } protected int overwriteBoth ( AddUpdateCommand cmd ) throws IOException { } protected int allowDups ( AddUpdateCommand cmd ) throws IOException { } protected void doDeletions ( ) throws IOException { } public void commit ( CommitUpdateCommand cmd ) throws IOException { } public void close ( ) throws IOException { } class CommitTracker implements Runnable { int docsUpperBound ; long timeUpperBound ; private final ScheduledExecutorService scheduler = Executors . newScheduledThreadPool ( 1 ) ; private ScheduledFuture pending ; long docsSinceCommit ; int autoCommitCount = 0 ; long lastAddedTime = - 1 ; public CommitTracker ( ) { } public void addedDocument ( ) { } public void didCommit ( ) { } public synchronized void run ( ) { long started = System . currentTimeMillis ( ) ; try { CommitUpdateCommand command = new CommitUpdateCommand ( false ) ; command . waitFlush = true ; command . waitSearcher = true ; commit ( command ) ; ( autoCommitCount ) ++ ; } catch ( Exception e ) { log . severe ( "auto<seq2seq4repair_space>commit<seq2seq4repair_space>error..." ) ; e . printStackTrace ( ) ; } finally { pending = null ; } if ( ( lastAddedTime ) > started ) { <START_BUG> if ( ( docsSinceCommit ) > ( docsUpperBound ) ) { <END_BUG> pending = scheduler . schedule ( this , 100 , TimeUnit . MILLISECONDS ) ; } else if ( ( timeUpperBound ) > 0 ) { pending = scheduler . schedule ( this , timeUpperBound , TimeUnit . MILLISECONDS ) ; } } } } public String getName ( ) { } public String getVersion ( ) { } public String getDescription ( ) { } public Category getCategory ( ) { } public String getSourceId ( ) { } public String getSource ( ) { } public URL [ ] getDocs ( ) { } public NamedList getStatistics ( ) { } public String toString ( ) { } }

Fix:
if ( ( ( docsUpperBound ) > 0 ) && ( ( docsSinceCommit ) > ( docsUpperBound ) ) ) {