Program: 84128
Project: 84128
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 {
  DatabaseConnection connection=getConnection();
  ResultSet checkTableRS=null;
  ResultSet checkColumnsRS=null;
  List<SqlStatement> statementsToExecute=new ArrayList<SqlStatement>();
  try {
    checkTableRS=connection.getMetaData().getTables(convertRequestedSchemaToCatalog(getDefaultSchemaName()),convertRequestedSchemaToSchema(getDefaultSchemaName()),getDatabaseChangeLogTableName(),new String[]{"String_Node_Str"});
    if (checkTableRS.next()) {
      changeLogTableExists=true;
      checkColumnsRS=connection.getMetaData().getColumns(convertRequestedSchemaToCatalog(getDefaultSchemaName()),convertRequestedSchemaToSchema(getDefaultSchemaName()),getDatabaseChangeLogTableName(),null);
      boolean hasDescription=false;
      boolean hasComments=false;
      boolean hasTag=false;
      boolean hasLiquibase=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;
        }
      }
      if (!hasDescription) {
        statementsToExecute.add(new AddColumnStatement(getDefaultSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasTag) {
        statementsToExecute.add(new AddColumnStatement(getDefaultSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasComments) {
        statementsToExecute.add(new AddColumnStatement(getDefaultSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasLiquibase) {
        statementsToExecute.add(new AddColumnStatement(getDefaultSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
    }
 else     if (!changeLogCreateAttempted) {
      changeLogCreateAttempted=true;
      getJdbcTemplate().comment("String_Node_Str");
      SqlStatement createTableStatement=getCreateChangeLogSQL();
      if (!canCreateChangeLogTable()) {
        throw new JDBCException("String_Node_Str" + getDatabaseChangeLogTableName() + "String_Node_Str"+ "String_Node_Str"+ createTableStatement);
      }
      statementsToExecute.add(createTableStatement);
      log.info("String_Node_Str" + getDatabaseChangeLogTableName());
      changeLogTableExists=true;
    }
    for (    SqlStatement sql : statementsToExecute) {
      this.getJdbcTemplate().execute(sql);
      this.commit();
    }
  }
 catch (  SQLException e) {
    throw new JDBCException(e);
  }
 finally {
    if (checkTableRS != null) {
      try {
        checkTableRS.close();
      }
 catch (      SQLException e) {
        throw new JDBCException(e);
      }
    }
    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 {
  DatabaseConnection connection=getConnection();
  ResultSet checkTableRS=null;
  ResultSet checkColumnsRS=null;
  List<SqlStatement> statementsToExecute=new ArrayList<SqlStatement>();
  try {
    checkTableRS=connection.getMetaData().getTables(convertRequestedSchemaToCatalog(getDefaultSchemaName()),convertRequestedSchemaToSchema(getDefaultSchemaName()),getDatabaseChangeLogTableName(),new String[]{"String_Node_Str"});
    if (checkTableRS.next()) {
      changeLogTableExists=true;
      checkColumnsRS=connection.getMetaData().getColumns(convertRequestedSchemaToCatalog(getDefaultSchemaName()),convertRequestedSchemaToSchema(getDefaultSchemaName()),getDatabaseChangeLogTableName(),null);
      boolean hasDescription=false;
      boolean hasComments=false;
      boolean hasTag=false;
      boolean hasLiquibase=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;
        }
      }
      if (!hasDescription) {
        statementsToExecute.add(new AddColumnStatement(getDefaultSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasTag) {
        statementsToExecute.add(new AddColumnStatement(getDefaultSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasComments) {
        statementsToExecute.add(new AddColumnStatement(getDefaultSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
      if (!hasLiquibase) {
        statementsToExecute.add(new AddColumnStatement(getDefaultSchemaName(),getDatabaseChangeLogTableName(),"String_Node_Str","String_Node_Str",null));
      }
    }
 else     if (!changeLogCreateAttempted) {
      changeLogCreateAttempted=true;
      getJdbcTemplate().comment("String_Node_Str");
      SqlStatement createTableStatement=getCreateChangeLogSQL();
      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()));
      changeLogTableExists=true;
    }
    for (    SqlStatement sql : statementsToExecute) {
      this.getJdbcTemplate().execute(sql);
      this.commit();
    }
  }
 catch (  SQLException e) {
    throw new JDBCException(e);
  }
 finally {
    if (checkTableRS != null) {
      try {
        checkTableRS.close();
      }
 catch (      SQLException e) {
        throw new JDBCException(e);
      }
    }
    if (checkColumnsRS != null) {
      try {
        checkColumnsRS.close();
      }
 catch (      SQLException e) {
        throw new JDBCException(e);
      }
    }
  }
}