Program: 132343
Project: 132343
Buggy source:
/** 
 * Starts the BabuDB database. If conf is instance of MasterConfig it comes with replication in master-mode. If conf is instance of SlaveConfig it comes with replication in slave-mode.
 * @param conf
 * @param staticInit
 * @throws BabuDBException
 */
BabuDB(BabuDBConfig conf,final StaticInitialization staticInit) throws BabuDBException {
  Logging.start(conf.getDebugLevel());
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + conf.getBaseDir());
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + conf.getDbLogDir());
  this.configuration=conf;
  this.databaseManager=new DatabaseManagerImpl(this);
  this.dbConfigFile=new DBConfig(this);
  this.snapshotManager=new SnapshotManagerImpl(this);
  this.dbCheckptr=new CheckpointerImpl(this);
  if (dbConfigFile.isConversionRequired()) {
    Logging.logMessage(Logging.LEVEL_WARN,Category.storage,this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    AutoConverter.initiateConversion(dbConfigFile.getDBFormatVersion(),conf);
  }
  snapshotManager.init();
  try {
    if (conf instanceof ReplicationConfig)     new FileIO((ReplicationConfig)conf).replayBackupFiles();
  }
 catch (  IOException io) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + "String_Node_Str",io.getMessage());
  }
  LSN dbLsn=null;
  for (  Database db : databaseManager.getDatabaseList()) {
    if (dbLsn == null)     dbLsn=((DatabaseImpl)db).getLSMDB().getOndiskLSN();
 else {
      LSN onDiskLSN=((DatabaseImpl)db).getLSMDB().getOndiskLSN();
      if (!(LSMDatabase.NO_DB_LSN.equals(dbLsn) || LSMDatabase.NO_DB_LSN.equals(onDiskLSN)) && !dbLsn.equals(onDiskLSN))       throw new RuntimeException("String_Node_Str" + onDiskLSN + "String_Node_Str"+ dbLsn);
    }
  }
  if (dbLsn == null) {
    dbLsn=new LSN(0,0);
  }
 else {
    dbLsn=new LSN(dbLsn.getViewId(),dbLsn.getSequenceNo() + 1);
  }
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
  LSN nextLSN=replayLogs(dbLsn);
  if (dbLsn.compareTo(nextLSN) > 0) {
    nextLSN=dbLsn;
  }
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + nextLSN);
  try {
    if (conf instanceof ReplicationConfig) {
      this.replicationManager=new ReplicationManagerImpl(this);
      Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
    }
 else {
      this.replicationManager=null;
      Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    Logging.logError(Logging.LEVEL_ERROR,this,e);
    throw new BabuDBException(ErrorCode.REPLICATION_FAILURE,e.getMessage());
  }
  try {
    this.logger=new DiskLogger(conf.getDbLogDir(),nextLSN.getViewId(),nextLSN.getSequenceNo(),conf.getSyncMode(),conf.getPseudoSyncWait(),conf.getMaxQueueLength() * conf.getNumThreads(),replicationManager);
    this.logger.start();
  }
 catch (  IOException ex) {
    throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str",ex);
  }
  if (conf.getNumThreads() > 0) {
    worker=new LSMDBWorker[conf.getNumThreads()];
    for (int i=0; i < conf.getNumThreads(); i++) {
      worker[i]=new LSMDBWorker(logger,i,(conf.getPseudoSyncWait() > 0),conf.getMaxQueueLength());
      worker[i].start();
    }
  }
 else {
    assert(conf.getNumThreads() == 0);
    worker=null;
  }
  if (dbConfigFile.isConversionRequired())   AutoConverter.completeConversion(this);
  dbCheckptr.init(logger,conf.getCheckInterval(),conf.getMaxLogfileSize());
  dbCheckptr.start();
  if (staticInit != null) {
    staticInit.initialize(databaseManager,snapshotManager,replicationManager);
  }
  this.stopped=new AtomicBoolean(false);
  if (replicationManager != null)   replicationManager.initialize();
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str" + BABUDB_VERSION + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Starts the BabuDB database. If conf is instance of MasterConfig it comes with replication in master-mode. If conf is instance of SlaveConfig it comes with replication in slave-mode.
 * @param conf
 * @param staticInit
 * @throws BabuDBException
 */
BabuDB(BabuDBConfig conf,final StaticInitialization staticInit) throws BabuDBException {
  Logging.start(conf.getDebugLevel());
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + conf.getBaseDir());
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + conf.getDbLogDir());
  this.configuration=conf;
  this.databaseManager=new DatabaseManagerImpl(this);
  this.dbConfigFile=new DBConfig(this);
  this.snapshotManager=new SnapshotManagerImpl(this);
  this.dbCheckptr=new CheckpointerImpl(this);
  if (dbConfigFile.isConversionRequired()) {
    Logging.logMessage(Logging.LEVEL_WARN,Category.storage,this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    AutoConverter.initiateConversion(dbConfigFile.getDBFormatVersion(),conf);
  }
  snapshotManager.init();
  try {
    if (conf instanceof ReplicationConfig)     new FileIO((ReplicationConfig)conf).replayBackupFiles();
  }
 catch (  IOException io) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + "String_Node_Str",io.getMessage());
  }
  LSN dbLsn=null;
  for (  Database db : databaseManager.getDatabaseList()) {
    if (dbLsn == null)     dbLsn=((DatabaseImpl)db).getLSMDB().getOndiskLSN();
 else {
      LSN onDiskLSN=((DatabaseImpl)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(),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 {
    if (conf instanceof ReplicationConfig) {
      this.replicationManager=new ReplicationManagerImpl(this);
      Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
    }
 else {
      this.replicationManager=null;
      Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    Logging.logError(Logging.LEVEL_ERROR,this,e);
    throw new BabuDBException(ErrorCode.REPLICATION_FAILURE,e.getMessage());
  }
  try {
    this.logger=new DiskLogger(conf.getDbLogDir(),nextLSN.getViewId(),nextLSN.getSequenceNo(),conf.getSyncMode(),conf.getPseudoSyncWait(),conf.getMaxQueueLength() * conf.getNumThreads(),replicationManager);
    this.logger.start();
  }
 catch (  IOException ex) {
    throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str",ex);
  }
  if (conf.getNumThreads() > 0) {
    worker=new LSMDBWorker[conf.getNumThreads()];
    for (int i=0; i < conf.getNumThreads(); i++) {
      worker[i]=new LSMDBWorker(logger,i,(conf.getPseudoSyncWait() > 0),conf.getMaxQueueLength());
      worker[i].start();
    }
  }
 else {
    assert(conf.getNumThreads() == 0);
    worker=null;
  }
  if (dbConfigFile.isConversionRequired())   AutoConverter.completeConversion(this);
  dbCheckptr.init(logger,conf.getCheckInterval(),conf.getMaxLogfileSize());
  dbCheckptr.start();
  if (staticInit != null) {
    staticInit.initialize(databaseManager,snapshotManager,replicationManager);
  }
  this.stopped=new AtomicBoolean(false);
  if (replicationManager != null)   replicationManager.initialize();
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str" + BABUDB_VERSION + "String_Node_Str");
}