nus-yam/ex-repair huggingface dataset:
Program: 27122
Project: 27122
Buggy source:
/** 
 * Takes first   {@link ModelClass} from the cursor
 * @param dontMoveToFirst If it's a list or at a specific position, do not reset the cursor
 * @param table           The model class that we convert the cursor data into.
 * @param cursor          The cursor from the DB
 * @param < ModelClass >
 * @return
 */
@SuppressWarnings("String_Node_Str") public static <ModelClass extends Model>ModelClass convertToModel(boolean dontMoveToFirst,Class<ModelClass> table,Cursor cursor){
  ModelClass model=null;
  try {
    if (dontMoveToFirst || cursor.moveToFirst()) {
      ModelAdapter<ModelClass> modelAdapter=FlowManager.getModelAdapter(table);
      if (modelAdapter == null) {
        Class persistentClass=(Class)((ParameterizedType)table.getGenericSuperclass()).getActualTypeArguments()[0];
        if (persistentClass.isAssignableFrom(BaseModelView.class)) {
          model=(ModelClass)FlowManager.getModelViewAdapter((Class<? extends BaseModelView<? extends Model>>)table).loadFromCursor(cursor);
        }
      }
 else {
        model=modelAdapter.loadFromCursor(cursor);
      }
    }
  }
 catch (  Exception e) {
    FlowLog.log(FlowLog.Level.E,"String_Node_Str",e);
  }
  return model;
}

Fixed version (ground truth):
/** 
 * Takes first   {@link ModelClass} from the cursor
 * @param dontMoveToFirst If it's a list or at a specific position, do not reset the cursor
 * @param table           The model class that we convert the cursor data into.
 * @param cursor          The cursor from the DB
 * @param < ModelClass >
 * @return
 */
@SuppressWarnings("String_Node_Str") public static <ModelClass extends Model>ModelClass convertToModel(boolean dontMoveToFirst,Class<ModelClass> table,Cursor cursor){
  ModelClass model=null;
  try {
    if (dontMoveToFirst || cursor.moveToFirst()) {
      ModelAdapter<ModelClass> modelAdapter=FlowManager.getModelAdapter(table);
      if (modelAdapter == null) {
        if (BaseModelView.class.isAssignableFrom(table)) {
          model=(ModelClass)FlowManager.getModelViewAdapter((Class<? extends BaseModelView<? extends Model>>)table).loadFromCursor(cursor);
        }
      }
 else {
        model=modelAdapter.loadFromCursor(cursor);
      }
    }
  }
 catch (  Exception e) {
    FlowLog.log(FlowLog.Level.E,"String_Node_Str",e);
  }
  return model;
}
Program: 27123
Project: 27123
Buggy source:
/** 
 * Takes first   {@link ModelClass} from the cursor
 * @param dontMoveToFirst If it's a list or at a specific position, do not reset the cursor
 * @param table           The model class that we convert the cursor data into.
 * @param cursor          The cursor from the DB
 * @param < ModelClass >
 * @return
 */
@SuppressWarnings("String_Node_Str") public static <ModelClass extends Model>ModelClass convertToModel(boolean dontMoveToFirst,Class<ModelClass> table,Cursor cursor){
  ModelClass model=null;
  try {
    if (dontMoveToFirst || cursor.moveToFirst()) {
      ModelAdapter<ModelClass> modelAdapter=FlowManager.getModelAdapter(table);
      if (modelAdapter == null) {
        Class persistentClass=(Class)((ParameterizedType)table.getGenericSuperclass()).getActualTypeArguments()[0];
        if (persistentClass.isAssignableFrom(BaseModelView.class)) {
          model=(ModelClass)FlowManager.getModelViewAdapter((Class<? extends BaseModelView<? extends Model>>)table).loadFromCursor(cursor);
        }
      }
 else {
        model=modelAdapter.loadFromCursor(cursor);
      }
    }
  }
 catch (  Exception e) {
    FlowLog.log(FlowLog.Level.E,"String_Node_Str",e);
  }
  return model;
}

Fixed version (ground truth):
/** 
 * Takes first   {@link ModelClass} from the cursor
 * @param dontMoveToFirst If it's a list or at a specific position, do not reset the cursor
 * @param table           The model class that we convert the cursor data into.
 * @param cursor          The cursor from the DB
 * @param < ModelClass >
 * @return
 */
@SuppressWarnings("String_Node_Str") public static <ModelClass extends Model>ModelClass convertToModel(boolean dontMoveToFirst,Class<ModelClass> table,Cursor cursor){
  ModelClass model=null;
  try {
    if (dontMoveToFirst || cursor.moveToFirst()) {
      ModelAdapter<ModelClass> modelAdapter=FlowManager.getModelAdapter(table);
      if (modelAdapter == null) {
        if (BaseModelView.class.isAssignableFrom(table)) {
          model=(ModelClass)FlowManager.getModelViewAdapter((Class<? extends BaseModelView<? extends Model>>)table).loadFromCursor(cursor);
        }
      }
 else {
        model=modelAdapter.loadFromCursor(cursor);
      }
    }
  }
 catch (  Exception e) {
    FlowLog.log(FlowLog.Level.E,"String_Node_Str",e);
  }
  return model;
}
Program: 27124
Project: 27124
Buggy source:
/** 
 * Appends IS NOT NULL to the end of this condition
 * @return
 */
public Condition isNotNull(){
  mOperation="String_Node_Str";
  mValue="String_Node_Str";
  return this;
}

Fixed version (ground truth):
/** 
 * Appends IS NOT NULL to the end of this condition
 * @return
 */
public Condition isNotNull(){
  mOperation=String.format("String_Node_Str",Operation.IS_NOT_NULL);
  return this;
}
Program: 27125
Project: 27125
Buggy source:
/** 
 * Appends the condition to the   {@link com.raizlabs.android.dbflow.sql.builder.ConditionQueryBuilder}
 * @param conditionQueryBuilder
 */
public void appendConditionToQuery(ConditionQueryBuilder conditionQueryBuilder){
  conditionQueryBuilder.append(columnName()).append(operation()).append(conditionQueryBuilder.convertValueToString(value()));
  if (postArgument() != null) {
    conditionQueryBuilder.appendSpace().append(postArgument());
  }
}

Fixed version (ground truth):
/** 
 * Appends the condition to the   {@link com.raizlabs.android.dbflow.sql.builder.ConditionQueryBuilder}
 * @param conditionQueryBuilder
 */
public void appendConditionToQuery(ConditionQueryBuilder conditionQueryBuilder){
  conditionQueryBuilder.append(columnName()).append(operation());
  if (!Operation.IS_NOT_NULL.equals(operation()) && !Operation.IS_NULL.equals(operation())) {
    conditionQueryBuilder.append(conditionQueryBuilder.convertValueToString(value()));
  }
  if (postArgument() != null) {
    conditionQueryBuilder.appendSpace().append(postArgument());
  }
}
Program: 27126
Project: 27126
Buggy source:
/** 
 * Appends IS NULL to the end of this condition
 * @return
 */
public Condition isNull(){
  mOperation="String_Node_Str";
  mValue="String_Node_Str";
  return this;
}

Fixed version (ground truth):
/** 
 * Appends IS NULL to the end of this condition
 * @return
 */
public Condition isNull(){
  mOperation=String.format("String_Node_Str",Operation.IS_NULL);
  return this;
}
Program: 27127
Project: 27127
Buggy source:
protected void setPreviousSeparator(String separator){
  if (mParams.size() > 0) {
    mParams.get(mParams.size()).separator(separator);
  }
}

Fixed version (ground truth):
protected void setPreviousSeparator(String separator){
  if (mParams.size() > 0) {
    mParams.get(mParams.size() - 1).separator(separator);
  }
}
Program: 27128
Project: 27128
Buggy source:
public MockConditionQueryBuilder appendCreation(String modelClassName){
  return append("String_Node_Str").appendSpace().append("String_Node_Str").append(modelClassName).append("String_Node_Str").append(ModelUtils.getFieldClass(modelClassName)).append("String_Node_Str");
}

Fixed version (ground truth):
public MockConditionQueryBuilder appendCreation(String modelClassName){
  return appendEmptyCreation(modelClassName).append("String_Node_Str");
}
Program: 27129
Project: 27129
Buggy source:
/** 
 * Appends a condition to this map. It will take the value and see if a   {@link com.grosner.dbflow.converter.TypeConverter}exists for the field. If so, we convert it to the database value. Also if the value is a string, we escape the string.
 * @param condition The condition to append
 * @return This instance
 */
public ConditionQueryBuilder<ModelClass> putCondition(Condition condition){
  mParams.put(condition.columnName(),condition);
  isChanged=true;
  return this;
}

Fixed version (ground truth):
/** 
 * Appends a condition to this map. It will take the value and see if a   {@link com.grosner.dbflow.converter.TypeConverter}exists for the field. If so, we convert it to the database valu  e. Also if the value is a string, we escape the string.
 * @param condition The condition to append
 * @return This instance
 */
public ConditionQueryBuilder<ModelClass> putCondition(Condition condition){
  mParams.put(condition.columnName(),condition);
  isChanged=true;
  return this;
}
Program: 27130
Project: 27130
Buggy source:
public abstract ConditionQueryBuilder<ModelClass> getFullModelWhere(ModelViewClass model);

Fixed version (ground truth):
public abstract ConditionQueryBuilder<ModelViewClass> getFullModelWhere(ModelViewClass model);
Program: 27131
Project: 27131
Buggy source:
/** 
 * @param table
 * @return the associated {@link com.grosner.dbflow.structure.ModelViewAdapter} for the specified table.
 */
abstract ModelViewAdapter getModelViewAdapterForTable(Class<? extends BaseModelView> table);

Fixed version (ground truth):
/** 
 * @param table the VIEW class to retrieve the ModelViewAdapter from.
 * @return the associated {@link com.grosner.dbflow.structure.ModelViewAdapter} for the specified table.
 */
abstract ModelViewAdapter getModelViewAdapterForTable(Class<? extends BaseModelView> table);
Program: 27132
Project: 27132
Buggy source:
/** 
 * Returns the associated   {@link com.grosner.dbflow.structure.ModelAdapter} within this database forthe specified table. If the Model is missing the  {@link com.grosner.dbflow.annotation.Table} annotation,this will fail.
 * @param table
 * @return
 */
abstract ModelAdapter getModelAdapterForTable(Class<? extends Model> table);

Fixed version (ground truth):
/** 
 * Returns the associated   {@link com.grosner.dbflow.structure.ModelAdapter} within this database forthe specified table. If the Model is missing the  {@link com.grosner.dbflow.annotation.Table} annotation,this will fail.
 * @param table The model that exists in this database.
 * @return The ModelAdapter for the table.
 */
abstract ModelAdapter getModelAdapterForTable(Class<? extends Model> table);
Program: 27133
Project: 27133
Buggy source:
/** 
 * Register to listen for database changes
 * @param databaseHelperListener
 */
public void setHelperListener(DatabaseHelperListener databaseHelperListener){
  mHelperListener=databaseHelperListener;
}

Fixed version (ground truth):
/** 
 * Register to listen for database changes
 * @param databaseHelperListener Listens for DB changes
 */
public void setHelperListener(DatabaseHelperListener databaseHelperListener){
  mHelperListener=databaseHelperListener;
}
Program: 27134
Project: 27134
Buggy source:
/** 
 * @return
 */
abstract Map<Integer,List<Migration>> getMigrations();

Fixed version (ground truth):
/** 
 * @return The map of migrations to DB version
 */
abstract Map<Integer,List<Migration>> getMigrations();
Program: 27135
Project: 27135
Buggy source:
/** 
 * Internal method used to create the database schema.
 * @return
 */
abstract List<ModelAdapter> getModelAdapters();

Fixed version (ground truth):
/** 
 * Internal method used to create the database schema.
 * @return List of Model Adapters
 */
abstract List<ModelAdapter> getModelAdapters();
Program: 27136
Project: 27136
Buggy source:
public abstract boolean isForeignKeysSupported();

Fixed version (ground truth):
/** 
 * @return True if the {@link com.grosner.dbflow.annotation.Database} annotation is true.
 */
public abstract boolean isForeignKeysSupported();
Program: 27137
Project: 27137
Buggy source:
public void reset(Context context){
  if (!isResetting) {
    isResetting=true;
    context.deleteDatabase(getDatabaseName());
    isResetting=false;
  }
}

Fixed version (ground truth):
/** 
 * Performs a full deletion of this database.
 * @param context Where the database resides
 */
public void reset(Context context){
  if (!isResetting) {
    isResetting=true;
    context.deleteDatabase(getDatabaseName());
    mHelper=new FlowSQLiteOpenHelper(this,mInternalHelperListener);
    isResetting=false;
  }
}
Program: 27138
Project: 27138
Buggy source:
/** 
 * Returns a list of all model classes in this database.
 * @return
 */
abstract List<Class<? extends Model>> getModelClasses();

Fixed version (ground truth):
/** 
 * @return a list of all model classes in this database.
 */
abstract List<Class<? extends Model>> getModelClasses();
Program: 27139
Project: 27139
Buggy source:
public abstract boolean areConsistencyChecksEnabled();

Fixed version (ground truth):
/** 
 * @return True if the {@link com.grosner.dbflow.annotation.Database} annotation is true.
 */
public abstract boolean areConsistencyChecksEnabled();
Program: 27140
Project: 27140
Buggy source:
/** 
 * Will throw an exception if this class is not initialized yet in   {@link #initialize(android.content.Context,DBConfiguration)}
 * @return
 */
public static Context getContext(){
  if (context == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  return context;
}

Fixed version (ground truth):
/** 
 * Will throw an exception if this class is not initialized yet in   {@link #init(android.content.Context)}
 * @return
 */
public static Context getContext(){
  if (context == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  return context;
}
Program: 27141
Project: 27141
Buggy source:
/** 
 * Tells the queue if this request is ready to run. The default is true. This is run on the  {@link com.grosner.dbflow.runtime.DBTransactionQueue}'s thread.
 * @return
 */
public boolean onReady(){
  return true;
}

Fixed version (ground truth):
/** 
 * Tells the queue if this request is ready to run. The default is true. This is run on the  {@link com.grosner.dbflow.runtime.DBTransactionQueue}'s thread.
 * @return True if we run the request, if false we throw it away.
 */
public boolean onReady(){
  return true;
}
Program: 27142
Project: 27142
Buggy source:
/** 
 * Assigns operation to "<"
 * @param value The value of the column in the DB in String value
 * @return
 */
public Condition lessThan(Object value){
  mOperation="String_Node_Str";
  return value(value);
}

Fixed version (ground truth):
/** 
 * Assigns operation to "<"
 * @param value The value of the column in the DB
 * @return This condition
 */
public Condition lessThan(Object value){
  mOperation="String_Node_Str";
  return value(value);
}
Program: 27143
Project: 27143
Buggy source:
/** 
 * Assigns the operation to "="
 * @param value The value of the column in the DB in String value
 * @return
 */
public Condition is(Object value){
  mOperation="String_Node_Str";
  return value(value);
}

Fixed version (ground truth):
/** 
 * Assigns the operation to "="
 * @param value The value of the column in the DB
 * @return This condition
 */
public Condition is(Object value){
  mOperation="String_Node_Str";
  return value(value);
}
Program: 27144
Project: 27144
Buggy source:
/** 
 * Returns the value of the arg
 * @return
 */
public Object value(){
  return mValue;
}

Fixed version (ground truth):
/** 
 * @return the value of the argument
 */
public Object value(){
  return mValue;
}
Program: 27145
Project: 27145
Buggy source:
/** 
 * Returns the operation of it
 * @return
 */
public String operation(){
  return mOperation;
}

Fixed version (ground truth):
/** 
 * @return the operator such as "<", "<", or "="
 */
public String operation(){
  return mOperation;
}
Program: 27146
Project: 27146
Buggy source:
/** 
 * Assigns operation to ">"
 * @param value The value of the column in the DB in String value
 * @return
 */
public Condition greaterThan(Object value){
  mOperation="String_Node_Str";
  return value(value);
}

Fixed version (ground truth):
/** 
 * Assigns operation to ">"
 * @param value The value of the column in the DB
 * @return This condition
 */
public Condition greaterThan(Object value){
  mOperation="String_Node_Str";
  return value(value);
}
Program: 27147
Project: 27147
Buggy source:
/** 
 * Returns the column name
 * @return
 */
public String columnName(){
  return mColumn;
}

Fixed version (ground truth):
/** 
 * @return the column name
 */
public String columnName(){
  return mColumn;
}
Program: 27148
Project: 27148
Buggy source:
/** 
 * Converts the given value for the column
 * @param columnName The name of the column in the DB
 * @param value      The value of the column we are looking for
 * @return
 */
@SuppressWarnings("String_Node_Str") public String convertValueToString(String columnName,Object value){
  String stringVal;
  if (!useEmptyParams) {
  }
  if (value instanceof Number) {
    stringVal=String.valueOf(value);
  }
 else {
    stringVal=String.valueOf(value);
    if (!stringVal.equals(EMPTY_PARAM)) {
      stringVal=DatabaseUtils.sqlEscapeString(stringVal);
    }
  }
  return stringVal;
}

Fixed version (ground truth):
/** 
 * Converts the given value for the column
 * @param columnName The name of the column in the DB
 * @param value      The value of the column we are looking for
 * @return
 */
@SuppressWarnings("String_Node_Str") public String convertValueToString(String columnName,Object value){
  String stringVal;
  if (!useEmptyParams && value != null) {
    TypeConverter typeConverter=FlowManager.getTypeConverterForClass(value.getClass());
    if (typeConverter != null) {
      value=typeConverter.getDBValue(value);
    }
  }
  if (value instanceof Number) {
    stringVal=String.valueOf(value);
  }
 else {
    stringVal=String.valueOf(value);
    if (!stringVal.equals(EMPTY_PARAM)) {
      stringVal=DatabaseUtils.sqlEscapeString(stringVal);
    }
  }
  return stringVal;
}
Program: 27149
Project: 27149
Buggy source:
/** 
 * Constructs an instance of this class and   {@link ModelClass}.
 * @param tableClass
 */
public ConditionQueryBuilder(Class<ModelClass> tableClass,Condition... conditions){
  mTableStructure=FlowManager.getModelAdapter(tableClass);
  putConditions(conditions);
}

Fixed version (ground truth):
/** 
 * Constructs an instance of this class and   {@link ModelClass}.
 * @param table      The table to use
 * @param conditions The array of conditions to add to the mapping.
 */
public ConditionQueryBuilder(Class<ModelClass> table,Condition... conditions){
  mTableStructure=FlowManager.getModelAdapter(table);
  putConditions(conditions);
}
Program: 27150
Project: 27150
Buggy source:
/** 
 * Appends all the conditions from the specified array
 * @param conditions The array of conditions to add to the mapping.
 * @return
 */
public ConditionQueryBuilder<ModelClass> putConditions(Condition... conditions){
  if (conditions.length > 0) {
    for (    Condition condition : conditions) {
      mParams.put(condition.columnName(),condition);
    }
    isChanged=true;
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Appends all the conditions from the specified array
 * @param conditions The array of conditions to add to the mapping.
 * @return This instance
 */
public ConditionQueryBuilder<ModelClass> putConditions(Condition... conditions){
  if (conditions.length > 0) {
    for (    Condition condition : conditions) {
      mParams.put(condition.columnName(),condition);
    }
    isChanged=true;
  }
  return this;
}
Program: 27151
Project: 27151
Buggy source:
/** 
 * Add a column to the DB. This does not necessarily need to be reflected in the   {@link ModelClass}, but it is recommended.
 * @param columnType
 * @param columnName
 * @return
 */
public AlterTableMigration<ModelClass> addColumn(Class columnType,String columnName){
  if (mColumnDefinitions == null) {
    mColumnDefinitions=new ArrayList<QueryBuilder>();
  }
  QueryBuilder queryBuilder=new QueryBuilder().append(columnName).appendSpace().appendType(columnType.getName());
  mColumnDefinitions.add(queryBuilder);
  return this;
}

Fixed version (ground truth):
/** 
 * Add a column to the DB. This does not necessarily need to be reflected in the   {@link ModelClass}, but it is recommended.
 * @param columnType The type of column that pertains to an {@link com.grosner.dbflow.sql.SQLiteType}
 * @param columnName The name of the column to add. Use the "$Table" class for the specified table.
 * @return This instance
 */
public AlterTableMigration<ModelClass> addColumn(Class columnType,String columnName){
  if (mColumnDefinitions == null) {
    mColumnDefinitions=new ArrayList<QueryBuilder>();
  }
  QueryBuilder queryBuilder=new QueryBuilder().append(columnName).appendSpace().appendType(columnType.getName());
  mColumnDefinitions.add(queryBuilder);
  return this;
}
Program: 27152
Project: 27152
Buggy source:
/** 
 * Call this to rename a table to a new name, such as changing either the   {@link com.grosner.dbflow.structure.Model} class nameor by changing the name through a  {@link com.grosner.dbflow.structure.Table}
 * @param oldName The new name to call the table.
 * @return
 */
public AlterTableMigration<ModelClass> renameFrom(String oldName){
  mOldTableName=oldName;
  mRenameQuery=new QueryBuilder().append("String_Node_Str").appendSpaceSeparated("String_Node_Str");
  return this;
}

Fixed version (ground truth):
/** 
 * Call this to rename a table to a new name, such as changing either the   {@link com.grosner.dbflow.structure.Model} class nameor by changing the name through a  {@link com.grosner.dbflow.structure.Table}
 * @param oldName The new name to call the table.
 * @return This instance
 */
public AlterTableMigration<ModelClass> renameFrom(String oldName){
  mOldTableName=oldName;
  mRenameQuery=new QueryBuilder().append("String_Node_Str").appendSpaceSeparated("String_Node_Str");
  return this;
}
Program: 27153
Project: 27153
Buggy source:
public String getRenameQuery(){
  QueryBuilder queryBuilder=new QueryBuilder(mQuery.getQuery()).append(mOldTableName).append(mRenameQuery).append(FlowManager.getTableName(mTable));
  return queryBuilder.getQuery();
}

Fixed version (ground truth):
/** 
 * @return The query that renames the table.
 */
public String getRenameQuery(){
  QueryBuilder queryBuilder=new QueryBuilder(mQuery.getQuery()).append(mOldTableName).append(mRenameQuery).append(FlowManager.getTableName(mTable));
  return queryBuilder.getQuery();
}
Program: 27154
Project: 27154
Buggy source:
public List<String> getColumnDefinitions(){
  String sql=mQuery.getQuery() + FlowManager.getTableName(mTable);
  List<String> columnDefinitions=new ArrayList<String>();
  if (mColumnDefinitions != null) {
    for (    QueryBuilder columnDefinition : mColumnDefinitions) {
      QueryBuilder queryBuilder=new QueryBuilder(sql).appendSpaceSeparated("String_Node_Str").append(columnDefinition.getQuery());
      columnDefinitions.add(queryBuilder.getQuery());
    }
  }
  return columnDefinitions;
}

Fixed version (ground truth):
/** 
 * @return A List of column definitions that add column to a table in the DB.
 */
public List<String> getColumnDefinitions(){
  String sql=mQuery.getQuery() + FlowManager.getTableName(mTable);
  List<String> columnDefinitions=new ArrayList<String>();
  if (mColumnDefinitions != null) {
    for (    QueryBuilder columnDefinition : mColumnDefinitions) {
      QueryBuilder queryBuilder=new QueryBuilder(sql).appendSpaceSeparated("String_Node_Str").append(columnDefinition.getQuery());
      columnDefinitions.add(queryBuilder.getQuery());
    }
  }
  return columnDefinitions;
}
Program: 27157
Project: 27157
Buggy source:
@Override protected void createColumnDefinitions(TypeElement element){
  List<? extends Element> variableElements=manager.getElements().getAllMembers(element);
  ColumnValidator columnValidator=new ColumnValidator();
  for (  Element variableElement : variableElements) {
    if (variableElement.getAnnotation(Column.class) != null) {
      ColumnDefinition columnDefinition=new ColumnDefinition(manager,(VariableElement)variableElement);
      if (columnValidator.validate(manager,columnDefinition)) {
        columnDefinitions.add(columnDefinition);
        if (columnDefinition.columnType == Column.PRIMARY_KEY) {
          primaryColumnDefinitions.add(columnDefinition);
        }
 else         if (columnDefinition.columnType == Column.FOREIGN_KEY) {
          foreignKeyDefinitions.add(columnDefinition);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void createColumnDefinitions(TypeElement element){
  List<? extends Element> variableElements=manager.getElements().getAllMembers(element);
  ColumnValidator columnValidator=new ColumnValidator();
  for (  Element variableElement : variableElements) {
    if (variableElement.getAnnotation(Column.class) != null) {
      ColumnDefinition columnDefinition=new ColumnDefinition(manager,(VariableElement)variableElement);
      if (columnValidator.validate(manager,columnDefinition)) {
        columnDefinitions.add(columnDefinition);
        if (columnDefinition.columnType == Column.PRIMARY_KEY) {
          primaryColumnDefinitions.add(columnDefinition);
        }
 else         if (columnDefinition.columnType == Column.FOREIGN_KEY) {
          foreignKeyDefinitions.add(columnDefinition);
        }
 else         if (columnDefinition.columnType == Column.PRIMARY_KEY_AUTO_INCREMENT) {
          autoIncrementDefinition=columnDefinition;
        }
      }
    }
  }
}
Program: 27158
Project: 27158
Buggy source:
public Map<Integer,List<MigrationDefinition>> getMigrationsForDatabase(String databaseName){
  if (hasOneDatabase()) {
    databaseName="String_Node_Str";
  }
  Map<Integer,List<MigrationDefinition>> migrationDefinitions=mMigrations.get(databaseName);
  if (migrationDefinitions != null) {
    return migrationDefinitions;
  }
 else {
    return Maps.newHashMap();
  }
}

Fixed version (ground truth):
public Map<Integer,List<MigrationDefinition>> getMigrationsForDatabase(String databaseName){
  Map<Integer,List<MigrationDefinition>> migrationDefinitions=mMigrations.get(databaseName);
  if (migrationDefinitions != null) {
    return migrationDefinitions;
  }
 else {
    return Maps.newHashMap();
  }
}
Program: 27159
Project: 27159
Buggy source:
public Set<ModelContainerDefinition> getModelContainers(String databaseName){
  if (hasOneDatabase()) {
    databaseName="String_Node_Str";
  }
  Map<String,ModelContainerDefinition> modelContainerDefinitionMap=mModelContainers.get(databaseName);
  if (modelContainerDefinitionMap != null) {
    return Sets.newHashSet(mModelContainers.get(databaseName).values());
  }
  return Sets.newHashSet();
}

Fixed version (ground truth):
public Set<ModelContainerDefinition> getModelContainers(String databaseName){
  Map<String,ModelContainerDefinition> modelContainerDefinitionMap=mModelContainers.get(databaseName);
  if (modelContainerDefinitionMap != null) {
    return Sets.newHashSet(mModelContainers.get(databaseName).values());
  }
  return Sets.newHashSet();
}
Program: 27160
Project: 27160
Buggy source:
public Set<TableDefinition> getTableDefinitions(String databaseName){
  if (hasOneDatabase()) {
    databaseName="String_Node_Str";
  }
  Map<String,TableDefinition> tableDefinitionMap=mTableDefinitions.get(databaseName);
  if (tableDefinitionMap != null) {
    return Sets.newHashSet(mTableDefinitions.get(databaseName).values());
  }
  return Sets.newHashSet();
}

Fixed version (ground truth):
public Set<TableDefinition> getTableDefinitions(String databaseName){
  Map<String,TableDefinition> tableDefinitionMap=mTableDefinitions.get(databaseName);
  if (tableDefinitionMap != null) {
    return Sets.newHashSet(mTableDefinitions.get(databaseName).values());
  }
  return Sets.newHashSet();
}
Program: 27161
Project: 27161
Buggy source:
public Set<ModelViewDefinition> getModelViewDefinitions(String databaseName){
  if (hasOneDatabase()) {
    databaseName="String_Node_Str";
  }
  Map<String,ModelViewDefinition> modelViewDefinitionMap=mModelViewDefinition.get(databaseName);
  if (modelViewDefinitionMap != null) {
    return Sets.newHashSet(mModelViewDefinition.get(databaseName).values());
  }
 else {
    return Sets.newHashSet();
  }
}

Fixed version (ground truth):
public Set<ModelViewDefinition> getModelViewDefinitions(String databaseName){
  Map<String,ModelViewDefinition> modelViewDefinitionMap=mModelViewDefinition.get(databaseName);
  if (modelViewDefinitionMap != null) {
    return Sets.newHashSet(mModelViewDefinition.get(databaseName).values());
  }
 else {
    return Sets.newHashSet();
  }
}
Program: 27162
Project: 27162
Buggy source:
public static boolean isSubclassOf(String columnFieldType,Class<?> enumClass){
  boolean isSubClass=false;
  try {
    Class type=Class.forName(columnFieldType);
    isSubClass=type.getSuperclass() != null && (type.getSuperclass().equals(enumClass) || isSubclassOf(type.getSuperclass().getTypeName(),enumClass));
  }
 catch (  ClassNotFoundException e) {
  }
  return isSubClass;
}

Fixed version (ground truth):
public static boolean isSubclassOf(String columnFieldType,Class<?> enumClass){
  boolean isSubClass=false;
  try {
    Class type=Class.forName(columnFieldType);
    isSubClass=type.getSuperclass() != null && (type.getSuperclass().equals(enumClass) || isSubclassOf(type.getSuperclass().getName(),enumClass));
  }
 catch (  ClassNotFoundException e) {
  }
  return isSubClass;
}
Program: 27164
Project: 27164
Buggy source:
@Override public boolean validate(ProcessorManager processorManager,TableDefinition tableDefinition){
  boolean success=true;
  if (tableDefinition.getColumnDefinitions() == null || tableDefinition.getColumnDefinitions().isEmpty()) {
    processorManager.logError("String_Node_Str",tableDefinition.tableName);
    success=false;
  }
  if (tableDefinition.primaryColumnDefinitions.isEmpty()) {
    processorManager.logError("String_Node_Str",tableDefinition.tableName);
    success=false;
  }
  if (!ProcessorUtils.implementsClass(processorManager.getProcessingEnvironment(),Classes.MODEL,(TypeElement)tableDefinition.element)) {
    processorManager.logError("String_Node_Str");
    success=false;
  }
  return success;
}

Fixed version (ground truth):
@Override public boolean validate(ProcessorManager processorManager,TableDefinition tableDefinition){
  boolean success=true;
  if (tableDefinition.getColumnDefinitions() == null || tableDefinition.getColumnDefinitions().isEmpty()) {
    processorManager.logError("String_Node_Str",tableDefinition.tableName);
    success=false;
  }
  boolean hasPrimary=(tableDefinition.autoIncrementDefinition != null && tableDefinition.primaryColumnDefinitions.isEmpty() || tableDefinition.autoIncrementDefinition == null && !tableDefinition.primaryColumnDefinitions.isEmpty());
  if (!hasPrimary) {
    processorManager.logError("String_Node_Str",tableDefinition.tableName);
    success=false;
  }
  if (!ProcessorUtils.implementsClass(processorManager.getProcessingEnvironment(),Classes.MODEL,(TypeElement)tableDefinition.element)) {
    processorManager.logError("String_Node_Str");
    success=false;
  }
  return success;
}
Program: 27167
Project: 27167
Buggy source:
@Override public void write(JavaWriter javaWriter) throws IOException {
  MockConditionQueryBuilder conditionQueryBuilder=new MockConditionQueryBuilder("String_Node_Str");
  conditionQueryBuilder.appendCreation(tableDefinition.getModelClassName());
  for (int i=0; i < definition.primaryColumnDefinitions.size(); i++) {
    ColumnDefinition columnDefinition=definition.primaryColumnDefinitions.get(i);
    conditionQueryBuilder.appendMockCondition(definition.definitionClassName + "String_Node_Str" + columnDefinition.columnName.toUpperCase(),"String_Node_Str");
    if (i < definition.primaryColumnDefinitions.size() - 1) {
      conditionQueryBuilder.append("String_Node_Str");
    }
  }
  conditionQueryBuilder.appendEndCreation();
  javaWriter.emitStatement(conditionQueryBuilder.getQuery());
}

Fixed version (ground truth):
@Override public void write(JavaWriter javaWriter) throws IOException {
  MockConditionQueryBuilder conditionQueryBuilder=new MockConditionQueryBuilder("String_Node_Str");
  conditionQueryBuilder.appendCreation(tableDefinition.getModelClassName());
  int primaryColumnSize=tableDefinition.getPrimaryColumnDefinitions().size();
  if (primaryColumnSize > 0) {
    for (int i=0; i < definition.primaryColumnDefinitions.size(); i++) {
      ColumnDefinition columnDefinition=definition.primaryColumnDefinitions.get(i);
      conditionQueryBuilder.appendMockCondition(definition.definitionClassName + "String_Node_Str" + columnDefinition.columnName.toUpperCase(),"String_Node_Str");
      if (i < definition.primaryColumnDefinitions.size() - 1) {
        conditionQueryBuilder.append("String_Node_Str");
      }
    }
  }
 else {
    ColumnDefinition autoIncrementDefinition=((TableDefinition)tableDefinition).autoIncrementDefinition;
    if (autoIncrementDefinition != null) {
      conditionQueryBuilder.appendMockCondition(definition.definitionClassName + "String_Node_Str" + autoIncrementDefinition.columnName.toUpperCase(),"String_Node_Str");
    }
  }
  conditionQueryBuilder.appendEndCreation();
  javaWriter.emitStatement(conditionQueryBuilder.getQuery());
}
Program: 27168
Project: 27168
Buggy source:
/** 
 * Defines a SQL ORDER BY statement without the ORDER BY.
 * @param ascending If we should be in ascending order
 * @return
 */
public Where<ModelClass> orderBy(boolean ascending,String... columns){
  mOrderBy=new QueryBuilder().appendArray(columns).appendSpace().append(ascending ? "String_Node_Str" : "String_Node_Str").getQuery();
  return this;
}

Fixed version (ground truth):
/** 
 * Defines a SQL ORDER BY statement without the ORDER BY.
 * @param ascending If we should be in ascending order
 * @return
 */
public Where<ModelClass> orderBy(String orderby){
  mOrderBy=orderby;
  return this;
}
Program: 27169
Project: 27169
Buggy source:
public FlowSQLiteOpenHelper(BaseDatabaseDefinition flowManager){
  super(FlowManager.getContext(),flowManager.getDatabaseName(),null,flowManager.getDatabaseVersion());
  mManager=flowManager;
  movePrepackagedDB(flowManager.getDatabaseName() + "String_Node_Str");
}

Fixed version (ground truth):
public FlowSQLiteOpenHelper(BaseDatabaseDefinition flowManager){
  super(FlowManager.getContext(),flowManager.getDatabaseName() + "String_Node_Str",null,flowManager.getDatabaseVersion());
  mManager=flowManager;
  movePrepackagedDB(flowManager.getDatabaseName() + "String_Node_Str");
}
Program: 27170
Project: 27170
Buggy source:
/** 
 * Returns a model at the specified position. If we are using the cache and it does not contain a model at that position, we move the cursor to the specified position and construct the   {@link ModelClass}.
 * @param position The row number in the {@link android.database.Cursor} to look at
 * @return The {@link ModelClass} converted from the cursor
 */
public ModelClass getItem(int position){
  ModelClass model;
  if (cacheModels) {
    model=mModelCache.get(position);
    if (model == null && mCursor.moveToPosition(position)) {
      model=SqlUtils.convertToModel(false,mTable,mCursor);
      mModelCache.put(position,model);
    }
  }
 else {
    mCursor.moveToPosition(position);
    model=SqlUtils.convertToModel(false,mTable,mCursor);
  }
  return model;
}

Fixed version (ground truth):
/** 
 * Returns a model at the specified position. If we are using the cache and it does not contain a model at that position, we move the cursor to the specified position and construct the   {@link ModelClass}.
 * @param position The row number in the {@link android.database.Cursor} to look at
 * @return The {@link ModelClass} converted from the cursor
 */
public ModelClass getItem(int position){
  ModelClass model;
  if (cacheModels) {
    model=mModelCache.get(position);
    if (model == null && mCursor.moveToPosition(position)) {
      model=SqlUtils.convertToModel(true,mTable,mCursor);
      mModelCache.put(position,model);
    }
  }
 else {
    mCursor.moveToPosition(position);
    model=SqlUtils.convertToModel(true,mTable,mCursor);
  }
  return model;
}
Program: 27171
Project: 27171
Buggy source:
/** 
 * Takes first   {@link ModelClass} from the cursor
 * @param isList       If it's a list, do not reset the cursor
 * @param table        The model class that we convert the cursor data into.
 * @param cursor       The cursor from the DB
 * @param < ModelClass >
 * @return
 */
@SuppressWarnings("String_Node_Str") public static <ModelClass extends Model>ModelClass convertToModel(boolean isList,Class<ModelClass> table,Cursor cursor){
  ModelClass model=null;
  try {
    if (isList || cursor.moveToFirst()) {
      ModelAdapter<ModelClass> modelAdapter=FlowManager.getModelAdapter(table);
      if (modelAdapter == null) {
        Class persistentClass=(Class)((ParameterizedType)table.getGenericSuperclass()).getActualTypeArguments()[0];
        if (persistentClass.isAssignableFrom(BaseModelView.class)) {
          model=(ModelClass)FlowManager.getModelViewAdapter((Class<? extends BaseModelView<? extends Model>>)table).loadFromCursor(cursor);
        }
      }
 else {
        model=modelAdapter.loadFromCursor(cursor);
      }
    }
  }
 catch (  Exception e) {
    FlowLog.log(FlowLog.Level.E,"String_Node_Str",e);
  }
  return model;
}

Fixed version (ground truth):
/** 
 * Takes first   {@link ModelClass} from the cursor
 * @param dontMoveToFirst If it's a list or at a specific position, do not reset the cursor
 * @param table           The model class that we convert the cursor data into.
 * @param cursor          The cursor from the DB
 * @param < ModelClass >
 * @return
 */
@SuppressWarnings("String_Node_Str") public static <ModelClass extends Model>ModelClass convertToModel(boolean dontMoveToFirst,Class<ModelClass> table,Cursor cursor){
  ModelClass model=null;
  try {
    if (dontMoveToFirst || cursor.moveToFirst()) {
      ModelAdapter<ModelClass> modelAdapter=FlowManager.getModelAdapter(table);
      if (modelAdapter == null) {
        Class persistentClass=(Class)((ParameterizedType)table.getGenericSuperclass()).getActualTypeArguments()[0];
        if (persistentClass.isAssignableFrom(BaseModelView.class)) {
          model=(ModelClass)FlowManager.getModelViewAdapter((Class<? extends BaseModelView<? extends Model>>)table).loadFromCursor(cursor);
        }
      }
 else {
        model=modelAdapter.loadFromCursor(cursor);
      }
    }
  }
 catch (  Exception e) {
    FlowLog.log(FlowLog.Level.E,"String_Node_Str",e);
  }
  return model;
}
Program: 27173
Project: 27173
Buggy source:
protected abstract Object getValue(String columnName);

Fixed version (ground truth):
@Override public abstract Object getValue(String columnName);
Program: 27174
Project: 27174
Buggy source:
public BaseModelContainer(Class<ModelClass> table){
  mTableStructure=FlowManager.getManagerForTable(table).getTableStructureForClass(table);
}

Fixed version (ground truth):
public BaseModelContainer(Class<ModelClass> table,DataClass data){
  mTableStructure=FlowManager.getManagerForTable(table).getTableStructureForClass(table);
  mData=data;
}
Program: 27175
Project: 27175
Buggy source:
protected abstract void put(String columnName,Object value);

Fixed version (ground truth):
@Override public abstract void put(String columnName,Object value);
Program: 27176
Project: 27176
Buggy source:
/** 
 * Constructs this object with an empty   {@link org.json.JSONObject} referencing the {@link ModelClass} table.
 * @param table The table of the referenced model
 */
public JSONModel(Class<ModelClass> table){
  this(new JSONObject(),table);
}

Fixed version (ground truth):
/** 
 * Constructs this object with an empty   {@link org.json.JSONObject} referencing the {@link ModelClass} table.
 * @param table The table of the referenced model
 */
public JSONModel(Class<ModelClass> table){
  super(table,new JSONObject());
}
Program: 27177
Project: 27177
Buggy source:
@Override protected Object getValue(String columnName){
  return mJson.opt(columnName);
}

Fixed version (ground truth):
@Override public Object getValue(String columnName){
  return getData().opt(columnName);
}
Program: 27178
Project: 27178
Buggy source:
/** 
 * Loads a model from the DB into the json stored in this class. It also will recreate the JSON stored in this object
 * @param primaryKeys The keys to reference
 */
public void load(Object... primaryKeys){
  mJson=new JSONObject();
  ConditionQueryBuilder<ModelClass> primaryQuery=FlowManager.getPrimaryWhereQuery(getTable());
  load(new Select().from(mTableStructure.getModelType()).where(primaryQuery.replaceEmptyParams(primaryKeys)).query());
}

Fixed version (ground truth):
/** 
 * Loads a model from the DB into the json stored in this class. It also will recreate the JSON stored in this object
 * @param primaryKeys The keys to reference
 */
public void load(Object... primaryKeys){
  setData(new JSONObject());
  ConditionQueryBuilder<ModelClass> primaryQuery=FlowManager.getPrimaryWhereQuery(getTable());
  load(new Select().from(mTableStructure.getModelType()).where(primaryQuery.replaceEmptyParams(primaryKeys)).query());
}
Program: 27179
Project: 27179
Buggy source:
@Override protected void put(String columnName,Object value){
  try {
    mJson.put(columnName,value);
  }
 catch (  JSONException e) {
    FlowLog.logError(e);
  }
}

Fixed version (ground truth):
@Override public void put(String columnName,Object value){
  try {
    getData().put(columnName,value);
  }
 catch (  JSONException e) {
    FlowLog.logError(e);
  }
}
Program: 27180
Project: 27180
Buggy source:
@Override protected Object getValue(String columnName){
  return mDatamap.get(columnName);
}

Fixed version (ground truth):
@Override public Object getValue(String columnName){
  return getData().get(columnName);
}
Program: 27181
Project: 27181
Buggy source:
public MapModel(Class<ModelClass> table){
  this(table,new HashMap<String,Object>());
}

Fixed version (ground truth):
public MapModel(Class<ModelClass> table){
  this(new HashMap<String,Object>(),table);
}
Program: 27182
Project: 27182
Buggy source:
@Override protected void put(String columnName,Object value){
  mDatamap.put(columnName,value);
}

Fixed version (ground truth):
@Override public void put(String columnName,Object value){
  getData().put(columnName,value);
}
Program: 27183
Project: 27183
Buggy source:
/** 
 * {@inheritDoc}
 * @param annotations
 * @param roundEnv
 */
@Override public boolean process(Set<? extends TypeElement> annotations,RoundEnvironment roundEnv){
  final Set<? extends Element> annotatedElements=roundEnv.getElementsAnnotatedWith(Table.class);
  if (annotatedElements.size() > 0) {
    Iterator<? extends Element> iterator=annotatedElements.iterator();
    while (iterator.hasNext()) {
      Element element=iterator.next();
      System.out.println(element.asType());
      try {
        final String packageName=processingEnv.getElementUtils().getPackageOf(element).toString();
        TableDefinition tableDefinition=new TableDefinition(packageName,element);
        JavaWriter javaWriter=new JavaWriter(processingEnv.getFiler().createSourceFile(tableDefinition.getFQCN()).openWriter());
        tableDefinition.write(javaWriter);
        javaWriter.close();
        tableDefinition.writeAdapter(processingEnv);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @param annotations
 * @param roundEnv
 */
@Override public boolean process(Set<? extends TypeElement> annotations,RoundEnvironment roundEnv){
  final Set<? extends Element> annotatedElements=roundEnv.getElementsAnnotatedWith(Table.class);
  if (annotatedElements.size() > 0) {
    Iterator<? extends Element> iterator=annotatedElements.iterator();
    while (iterator.hasNext()) {
      Element element=iterator.next();
      System.out.println(element.asType());
      try {
        final String packageName=processingEnv.getElementUtils().getPackageOf(element).toString();
        TableDefinition tableDefinition=new TableDefinition(processingEnv,packageName,element);
        JavaWriter javaWriter=new JavaWriter(processingEnv.getFiler().createSourceFile(tableDefinition.getFQCN()).openWriter());
        tableDefinition.write(javaWriter);
        javaWriter.close();
        tableDefinition.writeAdapter(processingEnv);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  return true;
}
Program: 27184
Project: 27184
Buggy source:
public void writeContentValue(JavaWriter javaWriter) throws IOException {
  javaWriter.emitStatement("String_Node_Str");
}

Fixed version (ground truth):
public void writeContentValue(JavaWriter javaWriter) throws IOException {
  if (columnType == Column.FOREIGN_KEY && isModel) {
    javaWriter.emitEmptyLine();
    if (isModelContainer) {
      javaWriter.emitSingleLineComment("String_Node_Str");
    }
 else {
      javaWriter.emitSingleLineComment("String_Node_Str");
    }
    javaWriter.emitStatement(getModelStatement(columnFieldName) + "String_Node_Str");
    for (    ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
      String contentValueString=columnFieldName + "String_Node_Str";
      if (isModelContainer) {
      }
 else {
        contentValueString+=foreignKeyReference.foreignColumnName();
      }
      javaWriter.emitStatement(getContentStatement(foreignKeyReference.columnName(),contentValueString));
    }
  }
 else {
    javaWriter.emitStatement(getContentStatement(columnName,columnFieldName));
  }
}
Program: 27185
Project: 27185
Buggy source:
@Override public void write(JavaWriter javaWriter) throws IOException {
  javaWriter.emitField("String_Node_Str",columnName.toUpperCase(),Sets.newHashSet(Modifier.PUBLIC,Modifier.STATIC,Modifier.FINAL),"String_Node_Str" + columnName + "String_Node_Str");
  javaWriter.emitEmptyLine();
}

Fixed version (ground truth):
@Override public void write(JavaWriter javaWriter) throws IOException {
  if (isModel || isModelContainer) {
    for (    ForeignKeyReference reference : foreignKeyReferences) {
      writeColumnDefinition(javaWriter,(columnName + "String_Node_Str" + reference.columnName()).toUpperCase(),reference.columnName());
    }
  }
 else {
    writeColumnDefinition(javaWriter,columnName);
  }
}
Program: 27186
Project: 27186
Buggy source:
public ColumnDefinition(VariableElement element){
  this.element=element;
  Column column=element.getAnnotation(Column.class);
  this.columnName=column.name();
  this.columnFieldName=element.getSimpleName().toString();
  this.columnFieldType=element.asType().toString();
  columnType=column.columnType();
}

Fixed version (ground truth):
public ColumnDefinition(ProcessingEnvironment processingEnvironment,VariableElement element){
  this.element=element;
  Column column=element.getAnnotation(Column.class);
  this.columnName=column.name().equals("String_Node_Str") ? element.getSimpleName().toString() : column.name();
  this.columnFieldName=element.getSimpleName().toString();
  this.columnFieldType=element.asType().toString();
  columnType=column.columnType();
  if (columnType == Column.FOREIGN_KEY) {
    foreignKeyReferences=column.references();
  }
  isModel=ProcessorUtils.implementsClass(processingEnvironment,"String_Node_Str",element);
  isModelContainer=ProcessorUtils.implementsClass(processingEnvironment,"String_Node_Str",element);
}
Program: 27187
Project: 27187
Buggy source:
public ContentValuesWriter(String tableName,String modelClassName,ArrayList<ColumnDefinition> columnDefinitions){
  this.columnDefinitions=columnDefinitions;
  this.modelClassName=modelClassName;
  this.tableName=tableName;
}

Fixed version (ground truth):
public ContentValuesWriter(TableDefinition tableDefinition){
  this.tableDefinition=tableDefinition;
}