Program: 84070
Project: 84070
Buggy source:
/** 
 * This method will check the database ChangeLog table used to keep track of the changes in the file. If the table does not exist it will create one otherwise it will not do anything besides outputting a log message.
 */
public void checkDatabaseChangeLogTable() throws JDBCException {
  WriteExecutor writeExecutor=ExecutorService.getInstance().getWriteExecutor(this);
  if (!writeExecutor.executesStatements()) {
    if (((LoggingExecutor)writeExecutor).alreadyCreatedChangeTable()) {
      return;
    }
 else {
      ((LoggingExecutor)writeExecutor).setAlreadyCreatedChangeTable(true);
    }
  }
  DatabaseConnection connection=getConnection();
  ResultSet checkColumnsRS=null;
  List<SqlStatement> statementsToExecute=new ArrayList<SqlStatement>();
  boolean changeLogCreateAttempted=false;
  try {
    if (doesChangeLogTableExist()) {
      checkColumnsRS=connection.getMetaData().getColumns(convertRequestedSchemaToCatalog(getLiquibaseSchemaName()),convertRequestedSchemaToSchema(getLiquibaseSchemaName()),getDatabaseChangeLogTableName(),null);
      boolean hasDescription=false;
      boolean hasComments=false;
      boolean hasTag=false;
      boolean hasLiquibase=false;
      boolean hasOrderExecuted=false;
      boolean checksumNotRightSize=false;
      while (checkColumnsRS.next()) {
        String columnName=checkColumnsRS.getString("String_Node_Str");
        if ("String_Node_Str".equalsIgnoreCase(columnName)) {
          hasDescription=true;
        }
 else         if ("String_Node_Str".equalsIgnoreCase(columnName)) {
          hasComments=true;
        }
 else         if ("String_Node_Str".equalsIgnoreCase(columnName)) {
          hasTag=true;
        }
 else         if ("String_Node_Str".equalsIgnoreCase(columnName)) {
          hasLiquibase=true;
        }
 else         if ("String_Node_Str".equalsIgnoreCase(columnName)) {
          hasOrderExecuted=true;
        }
 else         if ("String_Node_Str".equalsIgnoreCase(columnName) && checkColumnsRS.getInt("String_Node_Str") != 35) {
          checksumNotRightSize=true;
        }
      }
      if (!hasDescription) {
        writeExecutor.comment("String_Node_Str");
        statementsToExecute.add(new AddColumnStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasTag) {
        writeExecutor.comment("String_Node_Str");
        statementsToExecute.add(new AddColumnStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasComments) {
        writeExecutor.comment("String_Node_Str");
        statementsToExecute.add(new AddColumnStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasLiquibase) {
        writeExecutor.comment("String_Node_Str");
        statementsToExecute.add(new AddColumnStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasOrderExecuted) {
        writeExecutor.comment("String_Node_Str");
        statementsToExecute.add(new AddColumnStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null,new NotNullConstraint(),new UniqueConstraint()));
      }
      if (!checksumNotRightSize) {
        writeExecutor.comment("String_Node_Str");
        ColumnConfig checksumColumn=new ColumnConfig();
        checksumColumn.setName("String_Node_Str");
        checksumColumn.setType("String_Node_Str");
        statementsToExecute.add(new ModifyColumnsStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),checksumColumn));
      }
      ResultSet md5sumRS=connection.createStatement().executeQuery("String_Node_Str" + escapeTableName(getLiquibaseSchemaName(),getDatabaseChangeLogTableName()) + "String_Node_Str");
      if (md5sumRS.next()) {
        String md5sum=md5sumRS.getString(1);
        if (!md5sum.startsWith(CheckSum.getCurrentVersion() + "String_Node_Str")) {
          writeExecutor.comment("String_Node_Str");
          statementsToExecute.add(new RawSqlStatement("String_Node_Str" + escapeTableName(getLiquibaseSchemaName(),getDatabaseChangeLogTableName()) + "String_Node_Str"));
        }
      }
    }
 else     if (!changeLogCreateAttempted) {
      writeExecutor.comment("String_Node_Str");
      SqlStatement createTableStatement=new CreateDatabaseChangeLogTableStatement();
      if (!canCreateChangeLogTable()) {
        throw new JDBCException("String_Node_Str" + escapeTableName(getDefaultSchemaName(),getDatabaseChangeLogTableName()) + "String_Node_Str"+ "String_Node_Str"+ createTableStatement);
      }
      statementsToExecute.add(createTableStatement);
      log.info("String_Node_Str" + escapeTableName(getDefaultSchemaName(),getDatabaseChangeLogTableName()));
    }
    for (    SqlStatement sql : statementsToExecute) {
      writeExecutor.execute(sql,new ArrayList<SqlVisitor>());
      this.commit();
    }
  }
 catch (  SQLException e) {
    throw new JDBCException(e);
  }
 finally {
    if (checkColumnsRS != null) {
      try {
        checkColumnsRS.close();
      }
 catch (      SQLException e) {
        throw new JDBCException(e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * This method will check the database ChangeLog table used to keep track of the changes in the file. If the table does not exist it will create one otherwise it will not do anything besides outputting a log message.
 */
public void checkDatabaseChangeLogTable() throws JDBCException {
  WriteExecutor writeExecutor=ExecutorService.getInstance().getWriteExecutor(this);
  if (!writeExecutor.executesStatements()) {
    if (((LoggingExecutor)writeExecutor).alreadyCreatedChangeTable()) {
      return;
    }
 else {
      ((LoggingExecutor)writeExecutor).setAlreadyCreatedChangeTable(true);
    }
  }
  DatabaseConnection connection=getConnection();
  ResultSet checkColumnsRS=null;
  List<SqlStatement> statementsToExecute=new ArrayList<SqlStatement>();
  boolean changeLogCreateAttempted=false;
  try {
    if (doesChangeLogTableExist()) {
      checkColumnsRS=connection.getMetaData().getColumns(convertRequestedSchemaToCatalog(getLiquibaseSchemaName()),convertRequestedSchemaToSchema(getLiquibaseSchemaName()),getDatabaseChangeLogTableName(),null);
      boolean hasDescription=false;
      boolean hasComments=false;
      boolean hasTag=false;
      boolean hasLiquibase=false;
      boolean hasOrderExecuted=false;
      boolean checksumNotRightSize=false;
      while (checkColumnsRS.next()) {
        String columnName=checkColumnsRS.getString("String_Node_Str");
        if ("String_Node_Str".equalsIgnoreCase(columnName)) {
          hasDescription=true;
        }
 else         if ("String_Node_Str".equalsIgnoreCase(columnName)) {
          hasComments=true;
        }
 else         if ("String_Node_Str".equalsIgnoreCase(columnName)) {
          hasTag=true;
        }
 else         if ("String_Node_Str".equalsIgnoreCase(columnName)) {
          hasLiquibase=true;
        }
 else         if ("String_Node_Str".equalsIgnoreCase(columnName)) {
          hasOrderExecuted=true;
        }
 else         if ("String_Node_Str".equalsIgnoreCase(columnName) && checkColumnsRS.getInt("String_Node_Str") != 35) {
          checksumNotRightSize=true;
        }
      }
      if (!hasDescription) {
        writeExecutor.comment("String_Node_Str");
        statementsToExecute.add(new AddColumnStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasTag) {
        writeExecutor.comment("String_Node_Str");
        statementsToExecute.add(new AddColumnStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasComments) {
        writeExecutor.comment("String_Node_Str");
        statementsToExecute.add(new AddColumnStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasLiquibase) {
        writeExecutor.comment("String_Node_Str");
        statementsToExecute.add(new AddColumnStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasOrderExecuted) {
        writeExecutor.comment("String_Node_Str");
        statementsToExecute.add(new AddColumnStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null,new NotNullConstraint(),new UniqueConstraint()));
      }
      if (checksumNotRightSize) {
        writeExecutor.comment("String_Node_Str");
        ColumnConfig checksumColumn=new ColumnConfig();
        checksumColumn.setName("String_Node_Str");
        checksumColumn.setType("String_Node_Str");
        statementsToExecute.add(new ModifyColumnsStatement(getLiquibaseSchemaName(),getDatabaseChangeLogTableName(),checksumColumn));
      }
      ResultSet md5sumRS=connection.createStatement().executeQuery("String_Node_Str" + escapeTableName(getLiquibaseSchemaName(),getDatabaseChangeLogTableName()) + "String_Node_Str");
      if (md5sumRS.next()) {
        String md5sum=md5sumRS.getString(1);
        if (!md5sum.startsWith(CheckSum.getCurrentVersion() + "String_Node_Str")) {
          writeExecutor.comment("String_Node_Str");
          statementsToExecute.add(new RawSqlStatement("String_Node_Str" + escapeTableName(getLiquibaseSchemaName(),getDatabaseChangeLogTableName()) + "String_Node_Str"));
        }
      }
    }
 else     if (!changeLogCreateAttempted) {
      writeExecutor.comment("String_Node_Str");
      SqlStatement createTableStatement=new CreateDatabaseChangeLogTableStatement();
      if (!canCreateChangeLogTable()) {
        throw new JDBCException("String_Node_Str" + escapeTableName(getDefaultSchemaName(),getDatabaseChangeLogTableName()) + "String_Node_Str"+ "String_Node_Str"+ createTableStatement);
      }
      statementsToExecute.add(createTableStatement);
      log.info("String_Node_Str" + escapeTableName(getDefaultSchemaName(),getDatabaseChangeLogTableName()));
    }
    for (    SqlStatement sql : statementsToExecute) {
      writeExecutor.execute(sql,new ArrayList<SqlVisitor>());
      this.commit();
    }
  }
 catch (  SQLException e) {
    throw new JDBCException(e);
  }
 finally {
    if (checkColumnsRS != null) {
      try {
        checkColumnsRS.close();
      }
 catch (      SQLException e) {
        throw new JDBCException(e);
      }
    }
  }
}