Program: 84075
Project: 84075
Buggy source:
public SqlStatement[] generateStatements(Database database) throws UnsupportedChangeException {
  String schemaName=getSchemaName() == null ? database.getDefaultSchemaName() : getSchemaName();
  CreateTableStatement statement=new CreateTableStatement(schemaName,getTableName());
  for (  ColumnConfig column : getColumns()) {
    ConstraintsConfig constraints=column.getConstraints();
    boolean isAutoIncrement=column.isAutoIncrement() != null && column.isAutoIncrement();
    String defaultValue=null;
    if (column.hasDefaultValue()) {
      defaultValue=StringUtils.trimToNull(column.getDefaultColumnValue(database));
    }
    if (constraints != null && constraints.isPrimaryKey() != null && constraints.isPrimaryKey()) {
      statement.addPrimaryKeyColumn(column.getName(),database.getColumnType(column.getType(),isAutoIncrement),defaultValue,constraints.getPrimaryKeyName());
    }
 else {
      statement.addColumn(column.getName(),database.getColumnType(column.getType(),column.isAutoIncrement()),defaultValue);
    }
    if (constraints != null) {
      if (constraints.isNullable() != null && !constraints.isNullable()) {
        statement.addColumnConstraint(new NotNullConstraint(column.getName()));
      }
      if (constraints.getReferences() != null) {
        if (StringUtils.trimToNull(constraints.getForeignKeyName()) == null) {
          throw new UnsupportedChangeException("String_Node_Str");
        }
        ForeignKeyConstraint fkConstraint=new ForeignKeyConstraint(constraints.getForeignKeyName(),constraints.getReferences());
        fkConstraint.setColumn(column.getName());
        fkConstraint.setDeleteCascade(constraints.isDeleteCascade() != null && constraints.isDeleteCascade());
        fkConstraint.setInitiallyDeferred(constraints.isInitiallyDeferred() != null && constraints.isInitiallyDeferred());
        fkConstraint.setDeferrable(constraints.isDeferrable() != null && constraints.isDeferrable());
        statement.addColumnConstraint(fkConstraint);
      }
      if (constraints.isUnique() != null && constraints.isUnique()) {
        statement.addColumnConstraint(new UniqueConstraint(constraints.getUniqueConstraintName()).addColumns(column.getName()));
      }
    }
    if (isAutoIncrement) {
      statement.addColumnConstraint(new AutoIncrementConstraint(column.getName()));
    }
  }
  statement.setTablespace(StringUtils.trimToNull(getTablespace()));
  List<SqlStatement> statements=new ArrayList<SqlStatement>();
  statements.add(statement);
  return statements.toArray(new SqlStatement[statements.size()]);
}

Fixed version (ground truth):
public SqlStatement[] generateStatements(Database database) throws UnsupportedChangeException {
  String schemaName=getSchemaName() == null ? database.getDefaultSchemaName() : getSchemaName();
  CreateTableStatement statement=new CreateTableStatement(schemaName,getTableName());
  for (  ColumnConfig column : getColumns()) {
    ConstraintsConfig constraints=column.getConstraints();
    boolean isAutoIncrement=column.isAutoIncrement() != null && column.isAutoIncrement();
    String defaultValue=null;
    if (column.hasDefaultValue()) {
      defaultValue=StringUtils.trimToNull(column.getDefaultColumnValue(database));
    }
    if (constraints != null && constraints.isPrimaryKey() != null && constraints.isPrimaryKey()) {
      statement.addPrimaryKeyColumn(column.getName(),database.getColumnType(column.getType(),isAutoIncrement),defaultValue,constraints.getPrimaryKeyName());
    }
 else {
      statement.addColumn(column.getName(),database.getColumnType(column.getType(),column.isAutoIncrement()),defaultValue);
    }
    if (constraints != null) {
      if (constraints.isNullable() != null && !constraints.isNullable()) {
        statement.addColumnConstraint(new NotNullConstraint(column.getName()));
      }
      if (constraints.getReferences() != null) {
        if (StringUtils.trimToNull(constraints.getForeignKeyName()) == null) {
          throw new UnsupportedChangeException("String_Node_Str");
        }
        ForeignKeyConstraint fkConstraint=new ForeignKeyConstraint(constraints.getForeignKeyName(),constraints.getReferences());
        fkConstraint.setColumn(column.getName());
        fkConstraint.setDeleteCascade(constraints.isDeleteCascade() != null && constraints.isDeleteCascade());
        fkConstraint.setInitiallyDeferred(constraints.isInitiallyDeferred() != null && constraints.isInitiallyDeferred());
        fkConstraint.setDeferrable(constraints.isDeferrable() != null && constraints.isDeferrable());
        statement.addColumnConstraint(fkConstraint);
      }
      if (constraints.isUnique() != null && constraints.isUnique()) {
        statement.addColumnConstraint(new UniqueConstraint(constraints.getUniqueConstraintName()).addColumns(column.getName()));
      }
    }
    if (isAutoIncrement) {
      statement.addColumnConstraint(new AutoIncrementConstraint(column.getName()));
    }
  }
  statement.setTablespace(StringUtils.trimToNull(getTablespace()));
  List<SqlStatement> statements=new ArrayList<SqlStatement>();
  statements.add(statement);
  if (StringUtils.trimToNull(remarks) != null) {
    SetTableRemarksStatement remarksStatement=new SetTableRemarksStatement(schemaName,tableName,remarks);
    if (remarksStatement.supportsDatabase(database)) {
      statements.add(remarksStatement);
    }
  }
  for (  ColumnConfig column : getColumns()) {
    String columnRemarks=StringUtils.trimToNull(column.getRemarks());
    if (columnRemarks != null) {
      SetColumnRemarksStatement remarksStatement=new SetColumnRemarksStatement(schemaName,tableName,column.getName(),columnRemarks);
      if (remarksStatement.supportsDatabase(database)) {
        statements.add(remarksStatement);
      }
    }
  }
  return statements.toArray(new SqlStatement[statements.size()]);
}