Program: 132284
Project: 132284
Buggy source:
@Override public void init(StaticInitialization staticInit) throws BabuDBException {
synchronized (stopped) {
    responseManager.setLifeCycleListener(this);
    responseManager.start();
    snapshotManager.init();
    LSN dbLsn=null;
    for (    DatabaseInternal db : databaseManager.getDatabaseList()) {
      if (dbLsn == null)       dbLsn=db.getLSMDB().getOndiskLSN();
 else {
        LSN onDiskLSN=db.getLSMDB().getOndiskLSN();
        if (!(LSMDatabase.NO_DB_LSN.equals(dbLsn) || LSMDatabase.NO_DB_LSN.equals(onDiskLSN)))         dbLsn=dbLsn.compareTo(onDiskLSN) < 0 ? dbLsn : onDiskLSN;
      }
    }
    if (dbLsn == null) {
      dbLsn=new LSN(0,0);
    }
 else {
      dbLsn=new LSN(dbLsn.getViewId() == 0 ? 1 : dbLsn.getViewId(),dbLsn.getSequenceNo() + 1);
    }
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str",dbLsn);
    LSN nextLSN=replayLogs(dbLsn);
    if (dbLsn.compareTo(nextLSN) > 0) {
      nextLSN=dbLsn;
    }
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + nextLSN);
    try {
      logger=new DiskLogger(configuration.getDbLogDir(),nextLSN,configuration.getSyncMode(),configuration.getPseudoSyncWait(),configuration.getMaxQueueLength() * Math.max(1,configuration.getNumThreads()));
      logger.setLifeCycleListener(this);
      logger.start();
      logger.waitForStartup();
    }
 catch (    Exception ex) {
      throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str",ex);
    }
    this.txnMan.init(new LSN(nextLSN.getViewId(),nextLSN.getSequenceNo() - 1L));
    this.txnMan.setLogger(logger);
    if (configuration.getNumThreads() > 0) {
      worker=new LSMDBWorker[configuration.getNumThreads()];
      for (int i=0; i < configuration.getNumThreads(); i++) {
        worker[i]=new LSMDBWorker(this,i,configuration.getMaxQueueLength());
        worker[i].start();
      }
    }
 else {
      assert(configuration.getNumThreads() == 0);
      worker=null;
    }
    if (dbConfigFile.isConversionRequired())     AutoConverter.completeConversion(this);
    this.dbCheckptr.init(logger,configuration.getCheckInterval(),configuration.getMaxLogfileSize());
    final LSN firstLSN=new LSN(1,1L);
    if (staticInit != null && nextLSN.equals(firstLSN)) {
      Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str");
      staticInit.initialize(databaseManager,snapshotManager);
      Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str");
    }
 else     if (staticInit != null) {
      Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str");
    }
    this.stopped.set(false);
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str" + BABUDB_VERSION + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void init(StaticInitialization staticInit) throws BabuDBException {
synchronized (stopped) {
    responseManager.setLifeCycleListener(this);
    responseManager.start();
    snapshotManager.init();
    LSN dbLsn=null;
    for (    DatabaseInternal db : databaseManager.getDatabaseList()) {
      LSN onDiskLSN=db.getLSMDB().getOndiskLSN();
      if (LSMDatabase.NO_DB_LSN.equals(onDiskLSN))       continue;
      if (dbLsn == null || dbLsn.compareTo(onDiskLSN) > 0)       dbLsn=onDiskLSN;
    }
    if (dbLsn == null) {
      dbLsn=LSMDatabase.NO_DB_LSN;
    }
 else {
      dbLsn=new LSN(dbLsn.getViewId() == 0 ? 1 : dbLsn.getViewId(),dbLsn.getSequenceNo() + 1);
    }
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str",dbLsn);
    LSN nextLSN=replayLogs(dbLsn);
    if (dbLsn.compareTo(nextLSN) > 0) {
      nextLSN=dbLsn;
    }
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + nextLSN);
    try {
      logger=new DiskLogger(configuration.getDbLogDir(),nextLSN,configuration.getSyncMode(),configuration.getPseudoSyncWait(),configuration.getMaxQueueLength() * Math.max(1,configuration.getNumThreads()));
      logger.setLifeCycleListener(this);
      logger.start();
      logger.waitForStartup();
    }
 catch (    Exception ex) {
      throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str",ex);
    }
    this.txnMan.init(new LSN(nextLSN.getViewId(),nextLSN.getSequenceNo() - 1L));
    this.txnMan.setLogger(logger);
    if (configuration.getNumThreads() > 0) {
      worker=new LSMDBWorker[configuration.getNumThreads()];
      for (int i=0; i < configuration.getNumThreads(); i++) {
        worker[i]=new LSMDBWorker(this,i,configuration.getMaxQueueLength());
        worker[i].start();
      }
    }
 else {
      assert(configuration.getNumThreads() == 0);
      worker=null;
    }
    if (dbConfigFile.isConversionRequired())     AutoConverter.completeConversion(this);
    this.dbCheckptr.init(logger,configuration.getCheckInterval(),configuration.getMaxLogfileSize());
    final LSN firstLSN=new LSN(1,1L);
    if (staticInit != null && nextLSN.equals(firstLSN)) {
      Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str");
      staticInit.initialize(databaseManager,snapshotManager);
      Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str");
    }
 else     if (staticInit != null) {
      Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str");
    }
    this.stopped.set(false);
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str" + BABUDB_VERSION + "String_Node_Str");
  }
}