Program: 27236
Project: 27236
Buggy source:
/** 
 * Builds the structure of this table based on the   {@link com.grosner.dbflow.structure.Model}class passed in.
 * @param modelType
 */
public TableStructure(FlowManager flowManager,Class<ModelType> modelType){
  mManager=flowManager;
  mColumnNames=new HashMap<Field,String>();
  mFieldFromNames=new HashMap<String,Field>();
  mPrimaryKeys=new LinkedHashMap<String,Field>();
  mForeignKeys=new LinkedHashMap<String,Field>();
  mModelType=modelType;
  Table table=mModelType.getAnnotation(Table.class);
  if (table != null) {
    mTableName=table.name();
  }
 else {
    mTableName=mModelType.getSimpleName();
  }
  List<Field> fields=new ArrayList<Field>();
  fields=ReflectionUtils.getAllColumns(fields,mModelType);
  mCreationQuery=new TableCreationQueryBuilder();
  mCreationQuery.appendCreateTableIfNotExists(mTableName);
  ArrayList<QueryBuilder> mColumnDefinitions=new ArrayList<QueryBuilder>();
  for (  Field field : fields) {
    TableCreationQueryBuilder tableCreationQuery=new TableCreationQueryBuilder();
    Class type=field.getType();
    String columnName;
    Column column=field.getAnnotation(Column.class);
    if (column.name() != null && !column.name().equals("String_Node_Str")) {
      columnName=column.name();
    }
 else {
      columnName=field.getName();
    }
    mColumnNames.put(field,columnName);
    mFieldFromNames.put(columnName,field);
    if (column.value().value() == ColumnType.PRIMARY_KEY || column.value().value() == ColumnType.PRIMARY_KEY_AUTO_INCREMENT) {
      mPrimaryKeys.put(columnName,field);
    }
 else     if (column.value().value() == ColumnType.FOREIGN_KEY) {
      mForeignKeys.put(columnName,field);
    }
    if (SQLiteType.containsClass(type)) {
      tableCreationQuery.append(columnName).appendSpace().appendType(type);
    }
 else     if (ReflectionUtils.isSubclassOf(type,Enum.class)) {
      tableCreationQuery.append(columnName).appendSpace().appendSQLiteType(SQLiteType.TEXT);
    }
    mColumnDefinitions.add(tableCreationQuery.appendColumn(column));
  }
  if (!ReflectionUtils.implementsModelView(modelType)) {
    if (mPrimaryKeys.isEmpty()) {
      throw new PrimaryKeyNotFoundException("String_Node_Str" + mTableName + "String_Node_Str");
    }
    QueryBuilder primaryKeyQueryBuilder=new QueryBuilder().append("String_Node_Str");
    Collection<Field> primaryKeys=getPrimaryKeys();
    int count=0;
    int index=0;
    for (    Field field : primaryKeys) {
      Column primaryKey=field.getAnnotation(Column.class);
      if (primaryKey.value().value() != ColumnType.PRIMARY_KEY_AUTO_INCREMENT) {
        count++;
        primaryKeyQueryBuilder.append(mColumnNames.get(field));
        if (index < mPrimaryKeys.size() - 1) {
          primaryKeyQueryBuilder.append("String_Node_Str");
        }
      }
      index++;
    }
    if (count > 0) {
      primaryKeyQueryBuilder.append("String_Node_Str");
      mColumnDefinitions.add(primaryKeyQueryBuilder);
    }
    QueryBuilder foreignKeyQueryBuilder;
    Collection<Field> foreignKeys=getForeignKeys();
    for (    Field foreignKeyField : foreignKeys) {
      foreignKeyQueryBuilder=new QueryBuilder().append("String_Node_Str");
      Column foreignKey=foreignKeyField.getAnnotation(Column.class);
      foreignKeyQueryBuilder.append(mColumnNames.get(foreignKeyField)).append("String_Node_Str").appendSpaceSeparated("String_Node_Str").append(mTableName).append("String_Node_Str").append(foreignKey.foreignColumn()).append("String_Node_Str");
      mColumnDefinitions.add(foreignKeyQueryBuilder);
    }
  }
 else   if (!mPrimaryKeys.isEmpty() || !mForeignKeys.isEmpty()) {
    FlowLog.log(FlowLog.Level.E,"String_Node_Str");
  }
  mCreationQuery.appendColumnDefinitions(mColumnDefinitions).append("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Builds the structure of this table based on the   {@link com.grosner.dbflow.structure.Model}class passed in.
 * @param modelType
 */
public TableStructure(FlowManager flowManager,Class<ModelType> modelType){
  mManager=flowManager;
  mColumnNames=new HashMap<Field,String>();
  mFieldFromNames=new HashMap<String,Field>();
  mPrimaryKeys=new LinkedHashMap<String,Field>();
  mForeignKeys=new LinkedHashMap<String,Field>();
  mModelType=modelType;
  Table table=mModelType.getAnnotation(Table.class);
  if (table != null) {
    mTableName=table.name();
  }
 else {
    mTableName=mModelType.getSimpleName();
  }
  List<Field> fields=new ArrayList<Field>();
  fields=ReflectionUtils.getAllColumns(fields,mModelType);
  mCreationQuery=new TableCreationQueryBuilder();
  mCreationQuery.appendCreateTableIfNotExists(mTableName);
  ArrayList<QueryBuilder> mColumnDefinitions=new ArrayList<QueryBuilder>();
  for (  Field field : fields) {
    TableCreationQueryBuilder tableCreationQuery=new TableCreationQueryBuilder();
    Class type=field.getType();
    String columnName;
    Column column=field.getAnnotation(Column.class);
    if (column.name() != null && !column.name().equals("String_Node_Str")) {
      columnName=column.name();
    }
 else {
      columnName=field.getName();
    }
    mColumnNames.put(field,columnName);
    mFieldFromNames.put(columnName,field);
    if (column.value().value() == ColumnType.PRIMARY_KEY || column.value().value() == ColumnType.PRIMARY_KEY_AUTO_INCREMENT) {
      mPrimaryKeys.put(columnName,field);
    }
 else     if (column.value().value() == ColumnType.FOREIGN_KEY) {
      mForeignKeys.put(columnName,field);
    }
    if (SQLiteType.containsClass(type)) {
      tableCreationQuery.append(columnName).appendSpace().appendType(type);
    }
 else     if (ReflectionUtils.isSubclassOf(type,Enum.class)) {
      tableCreationQuery.append(columnName).appendSpace().appendSQLiteType(SQLiteType.TEXT);
    }
 else {
      TypeConverter typeConverter=mManager.getTypeConverterForClass(type);
      if (typeConverter != null) {
        tableCreationQuery.append(columnName).appendSpace().appendType(typeConverter.getDatabaseType());
      }
    }
    mColumnDefinitions.add(tableCreationQuery.appendColumn(column));
  }
  if (!ReflectionUtils.implementsModelView(modelType)) {
    if (mPrimaryKeys.isEmpty()) {
      throw new PrimaryKeyNotFoundException("String_Node_Str" + mTableName + "String_Node_Str");
    }
    QueryBuilder primaryKeyQueryBuilder=new QueryBuilder().append("String_Node_Str");
    Collection<Field> primaryKeys=getPrimaryKeys();
    int count=0;
    int index=0;
    for (    Field field : primaryKeys) {
      Column primaryKey=field.getAnnotation(Column.class);
      if (primaryKey.value().value() != ColumnType.PRIMARY_KEY_AUTO_INCREMENT) {
        count++;
        primaryKeyQueryBuilder.append(mColumnNames.get(field));
        if (index < mPrimaryKeys.size() - 1) {
          primaryKeyQueryBuilder.append("String_Node_Str");
        }
      }
      index++;
    }
    if (count > 0) {
      primaryKeyQueryBuilder.append("String_Node_Str");
      mColumnDefinitions.add(primaryKeyQueryBuilder);
    }
    QueryBuilder foreignKeyQueryBuilder;
    Collection<Field> foreignKeys=getForeignKeys();
    for (    Field foreignKeyField : foreignKeys) {
      foreignKeyQueryBuilder=new QueryBuilder().append("String_Node_Str");
      Column foreignKey=foreignKeyField.getAnnotation(Column.class);
      foreignKeyQueryBuilder.append(mColumnNames.get(foreignKeyField)).append("String_Node_Str").appendSpaceSeparated("String_Node_Str").append(mTableName).append("String_Node_Str").append(foreignKey.foreignColumn()).append("String_Node_Str");
      mColumnDefinitions.add(foreignKeyQueryBuilder);
    }
  }
 else   if (!mPrimaryKeys.isEmpty() || !mForeignKeys.isEmpty()) {
    FlowLog.log(FlowLog.Level.E,"String_Node_Str");
  }
  mCreationQuery.appendColumnDefinitions(mColumnDefinitions).append("String_Node_Str");
}