Program: 84113
Project: 84113
Buggy source:
public SqlStatement[] generateStatements(Database database) throws UnsupportedChangeException {
  List<SqlStatement> sql=new ArrayList<SqlStatement>();
  String schemaName=getSchemaName() == null ? database.getDefaultSchemaName() : getSchemaName();
  for (  ColumnConfig aColumn : columns) {
    Set<ColumnConstraint> constraints=new HashSet<ColumnConstraint>();
    if (aColumn.getConstraints() != null) {
      if (aColumn.getConstraints().isNullable() != null && !aColumn.getConstraints().isNullable()) {
        constraints.add(new NotNullConstraint());
      }
    }
    AddColumnStatement addColumnStatement=new AddColumnStatement(schemaName,getTableName(),aColumn.getName(),aColumn.getType(),aColumn.getDefaultValueObject(),constraints.toArray(new ColumnConstraint[constraints.size()]));
    sql.add(addColumnStatement);
    if (aColumn.getValueObject() != null) {
      UpdateStatement updateStatement=new UpdateStatement(schemaName,getTableName());
      updateStatement.addNewColumnValue(aColumn.getName(),aColumn.getValueObject());
      sql.add(updateStatement);
    }
  }
  for (  ColumnConfig aColumn : columns) {
    if (aColumn.getConstraints() != null) {
      if (aColumn.getConstraints().isPrimaryKey() != null && aColumn.getConstraints().isPrimaryKey()) {
        AddPrimaryKeyChange change=new AddPrimaryKeyChange();
        change.setSchemaName(schemaName);
        change.setTableName(getTableName());
        change.setColumnNames(aColumn.getName());
        sql.addAll(Arrays.asList(change.generateStatements(database)));
      }
    }
  }
  if (database instanceof DB2Database) {
    sql.add(new ReorganizeTableStatement(schemaName,getTableName()));
  }
  return sql.toArray(new SqlStatement[sql.size()]);
}

Fixed version (ground truth):
public SqlStatement[] generateStatements(Database database) throws UnsupportedChangeException {
  List<SqlStatement> sql=new ArrayList<SqlStatement>();
  String schemaName=getSchemaName() == null ? database.getDefaultSchemaName() : getSchemaName();
  for (  ColumnConfig aColumn : columns) {
    Set<ColumnConstraint> constraints=new HashSet<ColumnConstraint>();
    if (aColumn.getConstraints() != null) {
      if (aColumn.getConstraints().isNullable() != null && !aColumn.getConstraints().isNullable()) {
        constraints.add(new NotNullConstraint());
      }
      if (aColumn.getConstraints().isPrimaryKey() != null && aColumn.getConstraints().isPrimaryKey()) {
        constraints.add(new PrimaryKeyConstraint());
      }
    }
    if (aColumn.isAutoIncrement() != null && aColumn.isAutoIncrement()) {
      constraints.add(new AutoIncrementConstraint(aColumn.getName()));
    }
    AddColumnStatement addColumnStatement=new AddColumnStatement(schemaName,getTableName(),aColumn.getName(),aColumn.getType(),aColumn.getDefaultValueObject(),constraints.toArray(new ColumnConstraint[constraints.size()]));
    sql.add(addColumnStatement);
    if (aColumn.getValueObject() != null) {
      UpdateStatement updateStatement=new UpdateStatement(schemaName,getTableName());
      updateStatement.addNewColumnValue(aColumn.getName(),aColumn.getValueObject());
      sql.add(updateStatement);
    }
  }
  if (database instanceof DB2Database) {
    sql.add(new ReorganizeTableStatement(schemaName,getTableName()));
  }
  return sql.toArray(new SqlStatement[sql.size()]);
}