nus-yam/ex-repair huggingface dataset:
Program: 27188
Project: 27188
Buggy source:
@Override public void write(JavaWriter javaWriter) throws IOException {
  javaWriter.emitEmptyLine();
  javaWriter.emitAnnotation(Override.class);
  javaWriter.beginMethod("String_Node_Str","String_Node_Str",Sets.newHashSet(Modifier.PUBLIC),modelClassName,"String_Node_Str","String_Node_Str","String_Node_Str");
  javaWriter.emitStatement("String_Node_Str");
  for (  ColumnDefinition columnDefinition : columnDefinitions) {
    javaWriter.emitStatement("String_Node_Str",columnDefinition.columnName,"String_Node_Str" + columnDefinition.columnFieldName);
  }
  javaWriter.emitStatement("String_Node_Str",tableName,"String_Node_Str","String_Node_Str","String_Node_Str");
  javaWriter.endMethod();
  javaWriter.emitEmptyLine();
  javaWriter.emitAnnotation(Override.class);
  javaWriter.beginMethod("String_Node_Str","String_Node_Str",Sets.newHashSet(Modifier.PUBLIC),"String_Node_Str","String_Node_Str");
  javaWriter.endMethod();
}

Fixed version (ground truth):
@Override public void write(JavaWriter javaWriter) throws IOException {
  javaWriter.emitEmptyLine();
  javaWriter.emitAnnotation(Override.class);
  javaWriter.beginMethod("String_Node_Str","String_Node_Str",Sets.newHashSet(Modifier.PUBLIC),"String_Node_Str","String_Node_Str",tableDefinition.modelClassName,"String_Node_Str","String_Node_Str","String_Node_Str");
  javaWriter.emitStatement("String_Node_Str");
  for (  ColumnDefinition columnDefinition : tableDefinition.columnDefinitions) {
    columnDefinition.writeContentValue(javaWriter);
  }
  javaWriter.emitEmptyLine();
  javaWriter.emitStatement("String_Node_Str","String_Node_Str",tableDefinition.tableName,"String_Node_Str","String_Node_Str","String_Node_Str");
  javaWriter.endMethod();
}
Program: 27189
Project: 27189
Buggy source:
@Override public String getFQCN(){
  return packageName + "String_Node_Str" + className;
}

Fixed version (ground truth):
@Override public String getFQCN(){
  return packageName + "String_Node_Str" + tableSourceClassName;
}
Program: 27190
Project: 27190
Buggy source:
public TableDefinition(String packageName,Element element){
  this.element=element;
  this.packageName=packageName;
  this.className=element.getSimpleName() + DBFLOW_TABLE_TAG;
  this.adapterName=element.getSimpleName() + DBFLOW_TABLE_ADAPTER;
  this.tableName=element.getAnnotation(Table.class).name();
  columnDefinitions=getColumnDefinitions(element);
  mContentValuesWriter=new ContentValuesWriter(tableName,element.getSimpleName().toString(),columnDefinitions);
}

Fixed version (ground truth):
public TableDefinition(ProcessingEnvironment processingEnvironment,String packageName,Element element){
  this.element=element;
  this.packageName=packageName;
  this.modelClassName=element.getSimpleName().toString();
  this.tableSourceClassName=modelClassName + DBFLOW_TABLE_TAG;
  this.adapterName=modelClassName + DBFLOW_TABLE_ADAPTER;
  this.tableName=element.getAnnotation(Table.class).name();
  this.processingEnvironment=processingEnvironment;
  columnDefinitions=new ArrayList<>();
  primaryColumnDefinitions=new ArrayList<>();
  getColumnDefinitions(element);
  mContentValuesWriter=new ContentValuesWriter(this);
  mWhereQueryWriter=new WhereQueryWriter(this);
  mLoadCursorWriter=new LoadCursorWriter(this);
}
Program: 27191
Project: 27191
Buggy source:
public void writeAdapter(ProcessingEnvironment processingEnvironment) throws IOException {
  JavaWriter javaWriter=new JavaWriter(processingEnvironment.getFiler().createSourceFile(adapterName).openWriter());
  javaWriter.emitPackage(packageName);
  javaWriter.emitImports("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  javaWriter.beginType(adapterName,"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL),null,"String_Node_Str" + element.getSimpleName() + "String_Node_Str");
  mContentValuesWriter.write(javaWriter);
  javaWriter.endType();
  javaWriter.close();
}

Fixed version (ground truth):
public void writeAdapter(ProcessingEnvironment processingEnvironment) throws IOException {
  JavaWriter javaWriter=new JavaWriter(processingEnvironment.getFiler().createSourceFile(adapterName).openWriter());
  javaWriter.emitPackage(packageName);
  javaWriter.emitImports("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  javaWriter.beginType(adapterName,"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL),null,"String_Node_Str" + element.getSimpleName() + "String_Node_Str");
  mContentValuesWriter.write(javaWriter);
  mLoadCursorWriter.write(javaWriter);
  mWhereQueryWriter.write(javaWriter);
  javaWriter.endType();
  javaWriter.close();
}
Program: 27192
Project: 27192
Buggy source:
private static ArrayList<ColumnDefinition> getColumnDefinitions(Element element){
  List<VariableElement> variableElements=ElementFilter.fieldsIn(element.getEnclosedElements());
  ArrayList<ColumnDefinition> columns=new ArrayList<>();
  for (  VariableElement variableElement : variableElements) {
    if (variableElement.getAnnotation(Column.class) != null) {
      columns.add(new ColumnDefinition(variableElement));
    }
  }
  return columns;
}

Fixed version (ground truth):
private void getColumnDefinitions(Element element){
  List<VariableElement> variableElements=ElementFilter.fieldsIn(element.getEnclosedElements());
  for (  VariableElement variableElement : variableElements) {
    if (variableElement.getAnnotation(Column.class) != null) {
      ColumnDefinition columnDefinition=new ColumnDefinition(processingEnvironment,variableElement);
      columnDefinitions.add(columnDefinition);
      if (columnDefinition.columnType == Column.PRIMARY_KEY) {
        primaryColumnDefinitions.add(columnDefinition);
      }
    }
  }
}
Program: 27193
Project: 27193
Buggy source:
@Override public void write(JavaWriter javaWriter) throws IOException {
  javaWriter.emitPackage(packageName);
  javaWriter.beginType(className,"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL));
  javaWriter.emitEmptyLine();
  for (  ColumnDefinition columnDefinition : columnDefinitions) {
    columnDefinition.write(javaWriter);
  }
  javaWriter.endType();
}

Fixed version (ground truth):
@Override public void write(JavaWriter javaWriter) throws IOException {
  javaWriter.emitPackage(packageName);
  javaWriter.beginType(tableSourceClassName,"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL));
  javaWriter.emitEmptyLine();
  javaWriter.emitField("String_Node_Str","String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.STATIC,Modifier.FINAL),"String_Node_Str" + tableName + "String_Node_Str");
  javaWriter.emitEmptyLine();
  for (  ColumnDefinition columnDefinition : columnDefinitions) {
    columnDefinition.write(javaWriter);
  }
  javaWriter.endType();
}
Program: 27194
Project: 27194
Buggy source:
public void testUpdateEffect(){
  TestUpdateModel testUpdateModel=new TestUpdateModel();
  testUpdateModel.name="String_Node_Str";
  testUpdateModel.value="String_Node_Str";
  testUpdateModel.save(false);
  assertNotNull(TransactionManager.getInstance().selectModelById(TestUpdateModel.class,"String_Node_Str"));
  new Update().table(TestUpdateModel.class).set(Condition.column("String_Node_Str").is("String_Node_Str")).where().query();
  TestUpdateModel newUpdateModel=TransactionManager.getInstance().selectModelById(TestUpdateModel.class,"String_Node_Str");
  assertEquals("String_Node_Str",newUpdateModel.value);
}

Fixed version (ground truth):
public void testUpdateEffect(){
  TestUpdateModel testUpdateModel=new TestUpdateModel();
  testUpdateModel.name="String_Node_Str";
  testUpdateModel.value="String_Node_Str";
  testUpdateModel.save(false);
  assertNotNull(Select.byId(TestUpdateModel.class,"String_Node_Str"));
  new Update().table(TestUpdateModel.class).set(Condition.column("String_Node_Str").is("String_Node_Str")).where().query();
  TestUpdateModel newUpdateModel=Select.byId(TestUpdateModel.class,"String_Node_Str");
  assertEquals("String_Node_Str",newUpdateModel.value);
}
Program: 27195
Project: 27195
Buggy source:
/** 
 * Tests to ensure the model view operates as expected
 */
public void testModelView(){
  TestModel2 testModel2=new TestModel2();
  testModel2.order=6;
  testModel2.name="String_Node_Str";
  testModel2.save(false);
  testModel2=new TestModel2();
  testModel2.order=5;
  testModel2.name="String_Node_Str";
  testModel2.save(false);
  TransactionManager transactionManager=new TransactionManager("String_Node_Str",false);
  List<TestModelView> testModelViews=transactionManager.selectAllFromTable(TestModelView.class);
  assertTrue(!testModelViews.isEmpty());
  assertTrue(testModelViews.size() == 1);
}

Fixed version (ground truth):
/** 
 * Tests to ensure the model view operates as expected
 */
public void testModelView(){
  TestModel2 testModel2=new TestModel2();
  testModel2.order=6;
  testModel2.name="String_Node_Str";
  testModel2.save(false);
  testModel2=new TestModel2();
  testModel2.order=5;
  testModel2.name="String_Node_Str";
  testModel2.save(false);
  TransactionManager transactionManager=new TransactionManager("String_Node_Str",false);
  List<TestModelView> testModelViews=Select.all(TestModelView.class);
  assertTrue(!testModelViews.isEmpty());
  assertTrue(testModelViews.size() == 1);
}
Program: 27196
Project: 27196
Buggy source:
public void testConverters(){
  TestType testType=new TestType();
  testType.name="String_Node_Str";
  long testTime=System.currentTimeMillis();
  Calendar calendar=Calendar.getInstance();
  calendar.setTimeInMillis(testTime);
  testType.calendar=calendar;
  Date date=new Date(testTime);
  testType.date=date;
  java.sql.Date date1=new java.sql.Date(testTime);
  testType.sqlDate=date1;
  JSONObject jsonObject=null;
  try {
    jsonObject=new JSONObject("String_Node_Str");
    testType.json=jsonObject;
  }
 catch (  JSONException e) {
    throw new RuntimeException(e);
  }
  Location location=new Location("String_Node_Str");
  location.setLatitude(40.5);
  location.setLongitude(40.5);
  testType.location=location;
  testType.save(false);
  TestType retrieved=TransactionManager.getInstance().selectModelById(TestType.class,"String_Node_Str");
  assertNotNull(retrieved);
  assertNotNull(retrieved.calendar);
  assertTrue(retrieved.calendar.equals(calendar));
  assertNotNull(retrieved.date);
  assertTrue(retrieved.date.equals(date));
  assertNotNull(retrieved.sqlDate);
  assertTrue(retrieved.sqlDate.equals(date1));
  assertNotNull(retrieved.json);
  assertTrue(retrieved.json.toString().equals(jsonObject.toString()));
  assertNotNull(retrieved.location);
  assertTrue(retrieved.location.getLongitude() == location.getLongitude());
  assertTrue(retrieved.location.getLatitude() == location.getLatitude());
}

Fixed version (ground truth):
public void testConverters(){
  TestType testType=new TestType();
  testType.name="String_Node_Str";
  long testTime=System.currentTimeMillis();
  Calendar calendar=Calendar.getInstance();
  calendar.setTimeInMillis(testTime);
  testType.calendar=calendar;
  Date date=new Date(testTime);
  testType.date=date;
  java.sql.Date date1=new java.sql.Date(testTime);
  testType.sqlDate=date1;
  JSONObject jsonObject=null;
  try {
    jsonObject=new JSONObject("String_Node_Str");
    testType.json=jsonObject;
  }
 catch (  JSONException e) {
    throw new RuntimeException(e);
  }
  Location location=new Location("String_Node_Str");
  location.setLatitude(40.5);
  location.setLongitude(40.5);
  testType.location=location;
  testType.save(false);
  TestType retrieved=Select.byId(TestType.class,"String_Node_Str");
  assertNotNull(retrieved);
  assertNotNull(retrieved.calendar);
  assertTrue(retrieved.calendar.equals(calendar));
  assertNotNull(retrieved.date);
  assertTrue(retrieved.date.equals(date));
  assertNotNull(retrieved.sqlDate);
  assertTrue(retrieved.sqlDate.equals(date1));
  assertNotNull(retrieved.json);
  assertTrue(retrieved.json.toString().equals(jsonObject.toString()));
  assertNotNull(retrieved.location);
  assertTrue(retrieved.location.getLongitude() == location.getLongitude());
  assertTrue(retrieved.location.getLatitude() == location.getLatitude());
}
Program: 27197
Project: 27197
Buggy source:
/** 
 * Deletes all items from the table. Be careful as this will clear data!
 */
@Override public void clear(){
  if (transact) {
    TransactionManager.getInstance().delete(MODIFICATION_INFO,mCursorList.getTable());
  }
 else {
    TransactionManager.getInstance().delete(mCursorList.getTable());
  }
  mInternalResultReceiver.onResultReceived(null);
}

Fixed version (ground truth):
/** 
 * Deletes all items from the table. Be careful as this will clear data!
 */
@Override public void clear(){
  if (transact) {
    TransactionManager.getInstance().delete(MODIFICATION_INFO,mCursorList.getTable());
  }
 else {
    Delete.table(mCursorList.getTable());
  }
  mInternalResultReceiver.onResultReceived(null);
}
Program: 27198
Project: 27198
Buggy source:
/** 
 * If the processor class is annotated with   {@link javax.annotation.processing.SupportedAnnotationTypes}, return an unmodifiable set with the same set of strings as the annotation.  If the class is not so annotated, an empty set is returned.
 * @return the names of the annotation types supported by thisprocessor, or an empty set if none
 */
@Override public Set<String> getSupportedAnnotationTypes(){
  Set<String> supportedTypes=new LinkedHashSet<String>();
  supportedTypes.add(Table.class.getName());
  supportedTypes.add(Column.class.getName());
  return supportedTypes;
}

Fixed version (ground truth):
/** 
 * If the processor class is annotated with   {@link javax.annotation.processing.SupportedAnnotationTypes}, return an unmodifiable set with the same set of strings as the annotation.  If the class is not so annotated, an empty set is returned.
 * @return the names of the annotation types supported by thisprocessor, or an empty set if none
 */
@Override public Set<String> getSupportedAnnotationTypes(){
  Set<String> supportedTypes=new LinkedHashSet<String>();
  supportedTypes.add(Table.class.getName());
  supportedTypes.add(Column.class.getName());
  supportedTypes.add(TypeConverter.class.getName());
  supportedTypes.add(ContainerAdapter.class.getName());
  return supportedTypes;
}
Program: 27199
Project: 27199
Buggy source:
public static boolean implementsClass(ProcessingEnvironment processingEnvironment,String fqTn,TypeElement element){
  TypeElement typeElement=processingEnvironment.getElementUtils().getTypeElement(fqTn);
  if (typeElement == null) {
    processingEnvironment.getMessager().printMessage(Diagnostic.Kind.ERROR,"String_Node_Str" + fqTn);
    return false;
  }
 else {
    TypeMirror classMirror=typeElement.asType();
    return processingEnvironment.getTypeUtils().isAssignable(element.asType(),classMirror);
  }
}

Fixed version (ground truth):
public static boolean implementsClass(ProcessingEnvironment processingEnvironment,String fqTn,TypeElement element){
  TypeElement typeElement=processingEnvironment.getElementUtils().getTypeElement(fqTn);
  if (typeElement == null) {
    processingEnvironment.getMessager().printMessage(Diagnostic.Kind.ERROR,"String_Node_Str" + fqTn + "String_Node_Str"+ "String_Node_Str");
    return false;
  }
 else {
    TypeMirror classMirror=typeElement.asType();
    return processingEnvironment.getTypeUtils().isAssignable(element.asType(),classMirror);
  }
}
Program: 27200
Project: 27200
Buggy source:
protected void writeColumnDefinition(JavaWriter javaWriter,String fieldName,String columnName) throws IOException {
  javaWriter.emitField("String_Node_Str",fieldName,Sets.newHashSet(Modifier.PUBLIC,Modifier.STATIC,Modifier.FINAL),"String_Node_Str" + columnName + "String_Node_Str");
  javaWriter.emitEmptyLine();
}

Fixed version (ground truth):
/** 
 * When the field name is different from the column name (foreign key names)
 * @param javaWriter
 * @param fieldName
 * @param columnName
 * @throws IOException
 */
protected void writeColumnDefinition(JavaWriter javaWriter,String fieldName,String columnName) throws IOException {
  javaWriter.emitField("String_Node_Str",fieldName,Sets.newHashSet(Modifier.PUBLIC,Modifier.STATIC,Modifier.FINAL),"String_Node_Str" + columnName + "String_Node_Str");
  javaWriter.emitEmptyLine();
}
Program: 27201
Project: 27201
Buggy source:
public ColumnDefinition(ProcessorManager processorManager,VariableElement element){
  this.element=element;
  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();
  if (element.asType().getKind().isPrimitive()) {
    this.modelType=processorManager.getTypeUtils().boxedClass((PrimitiveType)element.asType());
  }
 else {
    this.modelType=processorManager.getElements().getTypeElement(element.asType().toString());
  }
  columnType=column.columnType();
  if (columnType == Column.FOREIGN_KEY) {
    foreignKeyReferences=column.references();
  }
  isModel=ProcessorUtils.implementsClass(processorManager.getProcessingEnvironment(),Classes.MODEL,modelType);
  final TypeConverterDefinition typeConverterDefinition=processorManager.getTypeConverterDefinition(modelType);
  if (typeConverterDefinition != null) {
    databaseType=typeConverterDefinition.getDbElement();
  }
 else {
    databaseType=modelType;
  }
  isModelContainer=ProcessorUtils.implementsClass(processorManager.getProcessingEnvironment(),Classes.MODEL_CONTAINER,modelType);
}

Fixed version (ground truth):
public ColumnDefinition(ProcessorManager processorManager,VariableElement element){
  this.processorManager=processorManager;
  this.element=element;
  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();
  if (element.asType().getKind().isPrimitive()) {
    this.modelType=processorManager.getTypeUtils().boxedClass((PrimitiveType)element.asType());
  }
 else {
    DeclaredType declaredType=(DeclaredType)element.asType();
    if (!declaredType.getTypeArguments().isEmpty()) {
      isModelContainer=true;
      modelContainerType=columnFieldType;
      this.modelType=(TypeElement)processorManager.getTypeUtils().asElement(declaredType.getTypeArguments().get(0));
      columnFieldType=modelType.asType().toString();
    }
 else {
      this.modelType=processorManager.getElements().getTypeElement(element.asType().toString());
    }
  }
  columnType=column.columnType();
  if (columnType == Column.FOREIGN_KEY) {
    foreignKeyReferences=column.references();
  }
  isModel=ProcessorUtils.implementsClass(processorManager.getProcessingEnvironment(),Classes.MODEL,modelType);
  final TypeConverterDefinition typeConverterDefinition=processorManager.getTypeConverterDefinition(modelType);
  if (typeConverterDefinition != null) {
    hasTypeConverter=true;
  }
  if (!hasTypeConverter && !isModel) {
    hasTypeConverter=!SQLiteType.containsClass(columnFieldType);
  }
}
Program: 27202
Project: 27202
Buggy source:
@Override public void write(JavaWriter javaWriter) throws IOException {
  javaWriter.emitPackage(packageName);
  javaWriter.emitImports(Classes.CONDITION_QUERY_BUILDER,Classes.MODEL_CONTAINER,Classes.MODEL_CONTAINER_UTILS,Classes.CONTAINER_ADAPTER,Classes.MODEL,Classes.CONTENT_VALUES,Classes.CURSOR,Classes.SQL_UTILS,Classes.SELECT,Classes.DELETE,Classes.CONDITION,Classes.TRANSACTION_MANAGER,Classes.PROCESS_MODEL_INFO,Classes.DBTRANSACTION_INFO);
  javaWriter.beginType(sourceFileName,"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL),"String_Node_Str" + classElement.getSimpleName() + "String_Node_Str");
  InternalAdapterHelper.writeGetModelClass(javaWriter,getModelClassQualifiedName());
  InternalAdapterHelper.writeGetTableName(javaWriter,classElement.getSimpleName().toString() + TableDefinition.DBFLOW_TABLE_TAG);
  mContentValuesWriter.write(javaWriter);
  mExistenceWriter.write(javaWriter);
  mWhereQueryWriter.write(javaWriter);
  mToModelWriter.write(javaWriter);
  mLoadCursorWriter.write(javaWriter);
  mDeleteWriter.write(javaWriter);
  javaWriter.endType();
  javaWriter.close();
}

Fixed version (ground truth):
@Override public void write(JavaWriter javaWriter) throws IOException {
  javaWriter.emitPackage(packageName);
  javaWriter.emitImports(Classes.FLOW_MANAGER,Classes.CONDITION_QUERY_BUILDER,Classes.MODEL_CONTAINER,Classes.MODEL_CONTAINER_UTILS,Classes.CONTAINER_ADAPTER,Classes.MODEL,Classes.CONTENT_VALUES,Classes.CURSOR,Classes.SQL_UTILS,Classes.SELECT,Classes.DELETE,Classes.CONDITION,Classes.TRANSACTION_MANAGER,Classes.PROCESS_MODEL_INFO,Classes.DBTRANSACTION_INFO);
  javaWriter.beginType(sourceFileName,"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL),"String_Node_Str" + classElement.getSimpleName() + "String_Node_Str");
  InternalAdapterHelper.writeGetModelClass(javaWriter,getModelClassQualifiedName());
  InternalAdapterHelper.writeGetTableName(javaWriter,classElement.getSimpleName().toString() + TableDefinition.DBFLOW_TABLE_TAG);
  mContentValuesWriter.write(javaWriter);
  mExistenceWriter.write(javaWriter);
  mWhereQueryWriter.write(javaWriter);
  mToModelWriter.write(javaWriter);
  mLoadCursorWriter.write(javaWriter);
  mDeleteWriter.write(javaWriter);
  javaWriter.endType();
  javaWriter.close();
}
Program: 27203
Project: 27203
Buggy source:
public TableDefinition(ProcessorManager manager,String packageName,Element element){
  this.element=element;
  this.packageName=packageName;
  this.modelClassName=element.getSimpleName().toString();
  this.tableSourceClassName=modelClassName + DBFLOW_TABLE_TAG;
  this.adapterName=modelClassName + DBFLOW_TABLE_ADAPTER;
  this.tableName=element.getAnnotation(Table.class).name();
  this.manager=manager;
  columnDefinitions=new ArrayList<>();
  primaryColumnDefinitions=new ArrayList<>();
  foreignKeyDefinitions=new ArrayList<>();
  getColumnDefinitions((TypeElement)element);
  mContentValuesWriter=new ContentValuesWriter(this,false);
  mWhereQueryWriter=new WhereQueryWriter(this,false);
  mLoadCursorWriter=new LoadCursorWriter(this,false);
  mExistenceWriter=new ExistenceWriter(this,false);
  mCreationQueryWriter=new CreationQueryWriter(manager,this);
  mDeleteWriter=new DeleteWriter(this,false);
}

Fixed version (ground truth):
public TableDefinition(ProcessorManager manager,String packageName,Element element){
  this.element=element;
  this.packageName=packageName;
  this.modelClassName=element.getSimpleName().toString();
  this.tableSourceClassName=modelClassName + DBFLOW_TABLE_TAG;
  this.adapterName=modelClassName + DBFLOW_TABLE_ADAPTER;
  this.tableName=element.getAnnotation(Table.class).name();
  if (tableName == null || tableName.isEmpty()) {
    tableName=element.getSimpleName().toString();
  }
  this.manager=manager;
  columnDefinitions=new ArrayList<>();
  primaryColumnDefinitions=new ArrayList<>();
  foreignKeyDefinitions=new ArrayList<>();
  getColumnDefinitions((TypeElement)element);
  mContentValuesWriter=new ContentValuesWriter(this,false);
  mWhereQueryWriter=new WhereQueryWriter(this,false);
  mLoadCursorWriter=new LoadCursorWriter(this,false);
  mExistenceWriter=new ExistenceWriter(this,false);
  mCreationQueryWriter=new CreationQueryWriter(manager,this);
  mDeleteWriter=new DeleteWriter(this,false);
}
Program: 27204
Project: 27204
Buggy source:
public void writeAdapter(ProcessingEnvironment processingEnvironment) throws IOException {
  JavaWriter javaWriter=new JavaWriter(processingEnvironment.getFiler().createSourceFile(adapterName).openWriter());
  javaWriter.emitPackage(packageName);
  javaWriter.emitImports(Classes.MODEL_ADAPTER,Classes.CONDITION_QUERY_BUILDER,Classes.CURSOR,Classes.CONTENT_VALUES,Classes.SQL_UTILS,Classes.SELECT,Classes.CONDITION,Classes.DELETE,Classes.TRANSACTION_MANAGER,Classes.PROCESS_MODEL_INFO,Classes.DBTRANSACTION_INFO);
  javaWriter.beginType(adapterName,"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL),"String_Node_Str" + element.getSimpleName() + "String_Node_Str");
  InternalAdapterHelper.writeGetModelClass(javaWriter,modelClassName);
  InternalAdapterHelper.writeGetTableName(javaWriter,tableSourceClassName);
  mContentValuesWriter.write(javaWriter);
  mExistenceWriter.write(javaWriter);
  mLoadCursorWriter.write(javaWriter);
  mWhereQueryWriter.write(javaWriter);
  mCreationQueryWriter.write(javaWriter);
  mDeleteWriter.write(javaWriter);
  javaWriter.endType();
  javaWriter.close();
}

Fixed version (ground truth):
public void writeAdapter(ProcessingEnvironment processingEnvironment) throws IOException {
  JavaWriter javaWriter=new JavaWriter(processingEnvironment.getFiler().createSourceFile(packageName + "String_Node_Str" + adapterName).openWriter());
  javaWriter.emitPackage(packageName);
  javaWriter.emitImports(Classes.MODEL_ADAPTER,Classes.FLOW_MANAGER,Classes.CONDITION_QUERY_BUILDER,Classes.CURSOR,Classes.CONTENT_VALUES,Classes.SQL_UTILS,Classes.SELECT,Classes.CONDITION,Classes.DELETE,Classes.TRANSACTION_MANAGER,Classes.PROCESS_MODEL_INFO,Classes.DBTRANSACTION_INFO);
  javaWriter.beginType(adapterName,"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL),"String_Node_Str" + element.getSimpleName() + "String_Node_Str");
  InternalAdapterHelper.writeGetModelClass(javaWriter,modelClassName);
  InternalAdapterHelper.writeGetTableName(javaWriter,tableSourceClassName);
  mContentValuesWriter.write(javaWriter);
  mExistenceWriter.write(javaWriter);
  mLoadCursorWriter.write(javaWriter);
  mWhereQueryWriter.write(javaWriter);
  mCreationQueryWriter.write(javaWriter);
  mDeleteWriter.write(javaWriter);
  javaWriter.endType();
  javaWriter.close();
}
Program: 27205
Project: 27205
Buggy source:
public void testJsonModel(){
  try {
    JSONObject jsonObject=new JSONObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    TestJsonModel<TestModel1> testJsonModel1=new TestJsonModel<TestModel1>(TestModel1.class,jsonObject);
    testJsonModel1.save(false);
    assertTrue(testJsonModel1.exists());
    assertNotNull(testJsonModel1.toModel());
    jsonObject=new JSONObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    TestJsonModel<TestJsonModelClass> testJsonModel=new TestJsonModel<TestJsonModelClass>(TestJsonModelClass.class,jsonObject);
    testJsonModel.save(false);
    assertTrue(testJsonModel.exists());
    assertNotNull(testJsonModel.toModel());
  }
 catch (  JSONException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void testJsonModel(){
  try {
    JSONObject jsonObject=new JSONObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    TestJsonModel<TestModel1> testJsonModel1=new TestJsonModel<TestModel1>(TestModel1.class,jsonObject);
    testJsonModel1.save(false);
    assertTrue(testJsonModel1.exists());
    assertNotNull(testJsonModel1.toModel());
    jsonObject=new JSONObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    TestJsonModel<TestJsonModelClass> testJsonModel=new TestJsonModel<TestJsonModelClass>(TestJsonModelClass.class,jsonObject);
    testJsonModel.save(false);
    assertTrue(testJsonModel.exists());
    assertNotNull(testJsonModel.toModel());
    assertNotNull(testJsonModel.toModel().testModel);
  }
 catch (  JSONException e) {
    throw new RuntimeException(e);
  }
}
Program: 27208
Project: 27208
Buggy source:
/** 
 * Loads a   {@link com.grosner.dbflow.structure.Model} from the DB cursor through reflection with thespecified  {@link com.grosner.dbflow.config.FlowManager}.
 * @param model        The model we load from the cursor
 * @param cursor       The cursor from the DB
 * @param < ModelClass > The class that implements {@link com.grosner.dbflow.structure.Model}
 */
@SuppressWarnings("String_Node_Str") public static <ModelClass extends Model>void loadFromCursor(ModelClass model,Cursor cursor){
  TableStructure<ModelClass> tableStructure=FlowManager.getManagerForTable(model.getClass()).getTableStructureForClass((Class<ModelClass>)model.getClass());
  Set<Field> fields=tableStructure.getColumns();
  for (  Field field : fields) {
    try {
      Object value=getModelValueFromCursor(cursor,tableStructure,field);
      if (value != null) {
        field.setAccessible(true);
        field.set(model,value);
      }
    }
 catch (    IllegalArgumentException e) {
      FlowLog.logError(e);
    }
catch (    IllegalAccessException e) {
      FlowLog.logError(e);
    }
catch (    SecurityException e) {
      FlowLog.logError(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Loads a   {@link com.grosner.dbflow.structure.Model} from the DB cursor through reflection with thespecified  {@link com.grosner.dbflow.config.FlowManager}.
 * @param model        The model we load from the cursor
 * @param cursor       The cursor from the DB
 * @param < ModelClass > The class that implements {@link com.grosner.dbflow.structure.Model}
 */
@SuppressWarnings("String_Node_Str") public static <ModelClass extends Model>void loadFromCursor(ModelClass model,Cursor cursor){
  TableStructure<ModelClass> tableStructure=FlowManager.getManagerForTable(model.getClass()).getTableStructureForClass((Class<ModelClass>)model.getClass());
  Set<Field> fields=tableStructure.getColumns();
  for (  Field field : fields) {
    try {
      Object value=getModelValueFromCursor(cursor,tableStructure,field,tableStructure.getColumnName(field),field.getType());
      if (value != null) {
        field.setAccessible(true);
        field.set(model,value);
      }
    }
 catch (    IllegalArgumentException e) {
      FlowLog.logError(e);
    }
catch (    IllegalAccessException e) {
      FlowLog.logError(e);
    }
catch (    SecurityException e) {
      FlowLog.logError(e);
    }
  }
}
Program: 27209
Project: 27209
Buggy source:
/** 
 * Loads a   {@link com.grosner.dbflow.structure.Model} from the DB cursor into {@link org.json.JSONObject} .
 * @param jsonModel    The {@link com.grosner.dbflow.structure.json.JSONModel} to load the cursor into
 * @param cursor       The cursor from the DB
 * @param < ModelClass > The class that implements {@link com.grosner.dbflow.structure.Model}
 */
public static <ModelClass extends Model>void loadFromCursor(JSONModel<ModelClass> jsonModel,Cursor cursor){
  Set<Field> fields=jsonModel.mTableStructure.getColumns();
  for (  Field field : fields) {
    Object value=SqlUtils.getModelValueFromCursor(cursor,jsonModel.mTableStructure,field);
    if (value != null) {
      try {
        jsonModel.mJson.put(jsonModel.mTableStructure.getColumnName(field),value);
      }
 catch (      JSONException e) {
        FlowLog.logError(e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Loads a   {@link com.grosner.dbflow.structure.Model} from the DB cursor into {@link org.json.JSONObject} .
 * @param jsonModel    The {@link com.grosner.dbflow.structure.json.JSONModel} to load the cursor into
 * @param cursor       The cursor from the DB
 * @param < ModelClass > The class that implements {@link com.grosner.dbflow.structure.Model}
 */
public static <ModelClass extends Model>void loadFromCursor(JSONModel<ModelClass> jsonModel,Cursor cursor){
  Set<Field> fields=jsonModel.mTableStructure.getColumns();
  for (  Field field : fields) {
    Object value=SqlUtils.getModelValueFromCursor(cursor,jsonModel.mTableStructure,field,jsonModel.mTableStructure.getColumnName(field),field.getType());
    if (value != null) {
      try {
        jsonModel.mJson.put(jsonModel.mTableStructure.getColumnName(field),value);
      }
 catch (      JSONException e) {
        FlowLog.logError(e);
      }
    }
  }
}
Program: 27210
Project: 27210
Buggy source:
/** 
 * Adds a join on a specific table for this query
 * @param table    The table this corresponds to
 * @param joinType The type of join to use
 * @return
 */
public Join join(Class<ModelClass> table,Join.JoinType joinType){
  Join join=new Join(this,table,joinType);
  mJoins.add(join);
  return join;
}

Fixed version (ground truth):
/** 
 * Adds a join on a specific table for this query
 * @param table    The table this corresponds to
 * @param joinType The type of join to use
 * @return
 */
public <JoinType extends Model>Join<JoinType> join(Class<JoinType> table,Join.JoinType joinType){
  Join<JoinType> join=new Join<JoinType>(this,table,joinType);
  mJoins.add(join);
  return join;
}
Program: 27211
Project: 27211
Buggy source:
Join(From from,Class<? extends Model> table,JoinType joinType){
  mFrom=from;
  mTable=table;
  mJoinType=joinType;
}

Fixed version (ground truth):
Join(From from,Class<ModelClass> table,JoinType joinType){
  mFrom=from;
  mTable=table;
  mJoinType=joinType;
}
Program: 27212
Project: 27212
Buggy source:
@Override public String getQuery(){
  QueryBuilder queryBuilder=new QueryBuilder();
  if (mJoinType != null) {
    queryBuilder.append(mJoinType.toString()).appendSpace();
  }
  queryBuilder.append("String_Node_Str").appendSpace().append(FlowManager.getManagerForTable(mTable).getTableName(mTable)).appendSpace();
  if (mAlias != null) {
    queryBuilder.append("String_Node_Str").append(mAlias).appendSpace();
  }
  if (mOn != null) {
    queryBuilder.append("String_Node_Str").appendSpace().append(mOn).appendSpace();
  }
 else   if (mUsing != null) {
    queryBuilder.append("String_Node_Str").appendArray(mUsing).append("String_Node_Str").appendSpace();
  }
  return queryBuilder.getQuery();
}

Fixed version (ground truth):
@Override public String getQuery(){
  QueryBuilder queryBuilder=new QueryBuilder();
  if (mJoinType != null) {
    queryBuilder.append(mJoinType.toString()).appendSpace();
  }
  queryBuilder.append("String_Node_Str").appendSpace().append(FlowManager.getTableName(mTable)).appendSpace();
  if (mAlias != null) {
    queryBuilder.append("String_Node_Str").append(mAlias).appendSpace();
  }
  if (mOn != null) {
    queryBuilder.append("String_Node_Str").appendSpace().append(mOn.getRawQuery()).appendSpace();
  }
 else   if (mUsing != null) {
    queryBuilder.append("String_Node_Str").appendArray(mUsing).append("String_Node_Str").appendSpace();
  }
  return queryBuilder.getQuery();
}
Program: 27213
Project: 27213
Buggy source:
public From on(String on){
  mOn=on;
  return mFrom;
}

Fixed version (ground truth):
public From on(Condition... onConditions){
  mOn=new ConditionQueryBuilder<ModelClass>(mTable,onConditions);
  return mFrom;
}
Program: 27214
Project: 27214
Buggy source:
public void testJsonModel(){
  try {
    JSONObject jsonObject=new JSONObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    TestJsonModel<TestModel1> testJsonModel1=new TestJsonModel<TestModel1>(TestModel1.class,jsonObject);
    testJsonModel1.save(false);
    assertTrue(testJsonModel1.exists());
    assertNotNull(testJsonModel1.toModel());
    jsonObject=new JSONObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    TestJsonModel<TestJsonModelClass> testJsonModel=new TestJsonModel<TestJsonModelClass>(TestJsonModelClass.class,jsonObject);
    testJsonModel.save(false);
    assertTrue(testJsonModel.exists());
    assertNotNull(testJsonModel.toModel());
    assertNotNull(testJsonModel.toModel().testModel);
  }
 catch (  JSONException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void testJsonModel(){
  try {
    JSONObject jsonObject=new JSONObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    JSONModel<TestModel1> testJsonModel1=new JSONModel<TestModel1>(jsonObject,TestModel1.class);
    testJsonModel1.save(false);
    assertTrue(testJsonModel1.exists());
    assertNotNull(testJsonModel1.toModel());
    jsonObject=new JSONObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    JSONModel<TestJsonModelClass> testJsonModel=new JSONModel<TestJsonModelClass>(jsonObject,TestJsonModelClass.class);
    testJsonModel.save(false);
    assertTrue(testJsonModel.exists());
    assertNotNull(testJsonModel.toModel());
    assertNotNull(testJsonModel.toModel().testModel);
  }
 catch (  JSONException e) {
    throw new RuntimeException(e);
  }
}
Program: 27215
Project: 27215
Buggy source:
/** 
 * The SQL from statement constructed.
 * @param querybase   The base query we append this query to
 * @param table       The table this corresponds to
 */
public From(Query querybase,Class<ModelClass> table){
  mQueryBuilderBase=querybase;
  mTable=table;
}

Fixed version (ground truth):
/** 
 * The SQL from statement constructed.
 * @param querybase The base query we append this query to
 * @param table     The table this corresponds to
 */
public From(Query querybase,Class<ModelClass> table){
  mQueryBuilderBase=querybase;
  mTable=table;
}
Program: 27216
Project: 27216
Buggy source:
@Override public String getQuery(){
  QueryBuilder queryBuilder=new QueryBuilder().append(mQueryBuilderBase.getQuery()).append("String_Node_Str").appendSpaceSeparated(FlowManager.getTableName(mTable)).appendQualifier("String_Node_Str",mAlias);
  for (  Join join : mJoins) {
    queryBuilder.append(join.getQuery());
  }
  return queryBuilder.getQuery().trim();
}

Fixed version (ground truth):
@Override public String getQuery(){
  QueryBuilder queryBuilder=new QueryBuilder().append(mQueryBuilderBase.getQuery());
  if (mQueryBuilderBase instanceof Select) {
    queryBuilder.append("String_Node_Str").appendSpaceSeparated(FlowManager.getTableName(mTable));
    queryBuilder.appendQualifier("String_Node_Str",mAlias);
    for (    Join join : mJoins) {
      queryBuilder.append(join.getQuery());
    }
  }
 else {
    queryBuilder.append(FlowManager.getTableName(mTable)).appendSpace();
  }
  return queryBuilder.getQuery();
}
Program: 27217
Project: 27217
Buggy source:
@Override public String getQuery(){
  QueryBuilder queryBuilder=new QueryBuilder(mUpdate.getQuery()).append("String_Node_Str").append(mConditionQueryBuilder.getQuery());
  return queryBuilder.getQuery();
}

Fixed version (ground truth):
@Override public String getQuery(){
  QueryBuilder queryBuilder=new QueryBuilder(mUpdate.getQuery()).append("String_Node_Str").append(mConditionQueryBuilder.getQuery()).appendSpace();
  return queryBuilder.getQuery();
}
Program: 27219
Project: 27219
Buggy source:
@Override public String getQuery(){
  QueryBuilder queryBuilder=new QueryBuilder("String_Node_Str");
  if (!TextUtils.isEmpty(mOrQualifier)) {
    queryBuilder.append(mOrQualifier).appendSpace();
  }
  return queryBuilder.getQuery();
}

Fixed version (ground truth):
@Override public String getQuery(){
  QueryBuilder queryBuilder=new QueryBuilder("String_Node_Str");
  if (!TextUtils.isEmpty(mOrQualifier)) {
    queryBuilder.append("String_Node_Str").appendSpaceSeparated(mOrQualifier);
  }
  return queryBuilder.getQuery();
}
Program: 27220
Project: 27220
Buggy source:
@Override public String getQuery(){
  String fromQuery=mWhereBase.getQuery();
  QueryBuilder queryBuilder=new QueryBuilder().append(fromQuery).appendSpace();
  queryBuilder.appendQualifier("String_Node_Str",mConditionQueryBuilder.getQuery()).appendQualifier("String_Node_Str",mGroupBy).appendQualifier("String_Node_Str",mHaving.getQuery()).appendQualifier("String_Node_Str",mOrderBy).appendQualifier("String_Node_Str",mLimit).appendQualifier("String_Node_Str",mOffset);
  if (FlowLog.isEnabled(FlowLog.Level.V)) {
    FlowLog.log(FlowLog.Level.V,queryBuilder.getQuery());
  }
  return queryBuilder.getQuery();
}

Fixed version (ground truth):
@Override public String getQuery(){
  String fromQuery=mWhereBase.getQuery();
  QueryBuilder queryBuilder=new QueryBuilder().append(fromQuery);
  queryBuilder.appendQualifier("String_Node_Str",mConditionQueryBuilder.getQuery()).appendQualifier("String_Node_Str",mGroupBy).appendQualifier("String_Node_Str",mHaving.getQuery()).appendQualifier("String_Node_Str",mOrderBy).appendQualifier("String_Node_Str",mLimit).appendQualifier("String_Node_Str",mOffset);
  if (FlowLog.isEnabled(FlowLog.Level.V)) {
    FlowLog.log(FlowLog.Level.V,queryBuilder.getQuery());
  }
  return queryBuilder.getQuery();
}
Program: 27222
Project: 27222
Buggy source:
public void testModelObserver(){
  List<ModelObserver<? extends Model>> modelObservers=mManager.getStructure().getModelObserverListForClass(TestModel1.class);
  assertNotNull(modelObservers);
  boolean found=false;
  for (  ModelObserver modelObserver : modelObservers) {
    if (modelObserver.getClass().equals(TestModelObserver.class)) {
      found=true;
      break;
    }
  }
  assertTrue(found);
}

Fixed version (ground truth):
public void testModelObserver(){
  List<ModelObserver<? extends Model>> modelObservers=mManager.getStructure().getModelObserverListForClass(TestModel1.class);
  assertNotNull(modelObservers);
  TestModelObserver model1Observer=null;
  for (  ModelObserver modelObserver : modelObservers) {
    if (modelObserver.getClass().equals(TestModelObserver.class)) {
      model1Observer=(TestModelObserver)modelObserver;
      break;
    }
  }
  assertNotNull(model1Observer);
  TestModel1 testModel1=new TestModel1();
  testModel1.id="String_Node_Str";
  testModel1.setManager(mManager);
  testModel1.save(false);
  final TestModelObserver finalModel1Observer=model1Observer;
  TransactionManager.getInstance().processOnRequestHandler(1000,new Runnable(){
    @Override public void run(){
      assertTrue(finalModel1Observer.isCalled());
    }
  }
);
}
Program: 27223
Project: 27223
Buggy source:
/** 
 * Runs UI operations in the handler
 * @param runnable
 */
public synchronized void processOnRequestHandler(Runnable runnable){
  mRequestHandler.post(runnable);
}

Fixed version (ground truth):
/** 
 * Runs UI operations in the handler with delay
 * @param runnable
 */
public synchronized void processOnRequestHandler(long delay,Runnable runnable){
  mRequestHandler.postDelayed(runnable,delay);
}
Program: 27224
Project: 27224
Buggy source:
@Override public void load(Cursor cursor){
  SqlUtils.loadFromCursor(FlowManager.getInstance(),this,cursor);
}

Fixed version (ground truth):
@Override public void load(Cursor cursor){
  SqlUtils.loadFromCursor(mManager,this,cursor);
}
Program: 27225
Project: 27225
Buggy source:
@Override public void save(boolean async){
  SqlUtils.save(FlowManager.getInstance(),this,async,SqlUtils.SAVE_MODE_DEFAULT,false);
}

Fixed version (ground truth):
@Override public void save(boolean async){
  SqlUtils.save(mManager,this,async,SqlUtils.SAVE_MODE_DEFAULT,false);
}
Program: 27226
Project: 27226
Buggy source:
/** 
 * Directly tries to insert this item into the DB without updating.
 * @param async If we want this to happen on the {@link com.grosner.dbflow.runtime.DBTransactionQueue}
 */
@Override public void insert(boolean async){
  SqlUtils.save(FlowManager.getInstance(),this,async,SqlUtils.SAVE_MODE_INSERT,false);
}

Fixed version (ground truth):
/** 
 * Directly tries to insert this item into the DB without updating.
 * @param async If we want this to happen on the {@link com.grosner.dbflow.runtime.DBTransactionQueue}
 */
@Override public void insert(boolean async){
  SqlUtils.save(mManager,this,async,SqlUtils.SAVE_MODE_INSERT,false);
}
Program: 27227
Project: 27227
Buggy source:
@Override public void update(boolean async){
  SqlUtils.save(FlowManager.getInstance(),this,async,SqlUtils.SAVE_MODE_UPDATE,false);
}

Fixed version (ground truth):
@Override public void update(boolean async){
  SqlUtils.save(mManager,this,async,SqlUtils.SAVE_MODE_UPDATE,false);
}
Program: 27228
Project: 27228
Buggy source:
@Override public boolean exists(){
  return SqlUtils.exists(FlowManager.getInstance(),this);
}

Fixed version (ground truth):
@Override public boolean exists(){
  return SqlUtils.exists(mManager,this);
}
Program: 27229
Project: 27229
Buggy source:
@Override public void delete(boolean async){
  SqlUtils.delete(FlowManager.getInstance(),this,async,false);
}

Fixed version (ground truth):
@Override public void delete(boolean async){
  SqlUtils.delete(mManager,this,async,false);
}
Program: 27230
Project: 27230
Buggy source:
/** 
 * Run this query and returns the   {@link android.database.Cursor} for it
 * @return the Sqlite {@link android.database.Cursor} from this query
 */
public Cursor query(){
  return mManager.getWritableDatabase().rawQuery(getQuery(),null);
}

Fixed version (ground truth):
/** 
 * Run this query and returns the   {@link android.database.Cursor} for it
 * @return the Sqlite {@link android.database.Cursor} from this query
 */
public Cursor query(){
  Cursor cursor=null;
  String query=getQuery();
  if (mWhereBase.getQueryBuilderBase() instanceof Select) {
    cursor=mManager.getWritableDatabase().rawQuery(query,null);
  }
 else {
    mManager.getWritableDatabase().execSQL(query);
  }
  return cursor;
}
Program: 27231
Project: 27231
Buggy source:
/** 
 * Checks to see if field is a   {@link com.grosner.dbflow.structure.ColumnType#PRIMARY_KEY}
 * @param field
 * @return
 */
public static boolean isPrimaryKey(Field field){
  Column column=field.getAnnotation(Column.class);
  boolean isPrimary=column != null;
  if (isPrimary) {
    isPrimary=column.value().value() != ColumnType.FOREIGN_KEY;
  }
  return isPrimary;
}

Fixed version (ground truth):
/** 
 * Checks to see if field is a   {@link com.grosner.dbflow.structure.ColumnType#PRIMARY_KEY}
 * @param field
 * @return
 */
public static boolean isPrimaryKey(Field field){
  Column column=field.getAnnotation(Column.class);
  boolean isPrimary=column != null;
  if (isPrimary) {
    isPrimary=(column.value().value() != ColumnType.FOREIGN_KEY && column.value().value() != ColumnType.NORMAL);
  }
  return isPrimary;
}
Program: 27232
Project: 27232
Buggy source:
/** 
 * This will append a SET columnName = value to this migration. It will execute each of these in succession with the order that this is called.
 * @param columnName
 * @param value
 * @return
 */
public UpdateTableMigration<ModelClass> set(String columnName,String value){
  if (mSetDefinitions == null) {
    mSetDefinitions=new ArrayList<QueryBuilder>();
  }
  QueryBuilder queryBuilder=new QueryBuilder().append(columnName).appendSpaceSeparated("String_Node_Str").append(value);
  mSetDefinitions.add(queryBuilder);
}

Fixed version (ground truth):
/** 
 * This will append a SET columnName = value to this migration. It will execute each of these in succession with the order that this is called.
 * @param columnName
 * @param value
 * @return
 */
public UpdateTableMigration<ModelClass> set(String columnName,String value){
  if (mSetDefinitions == null) {
    mSetDefinitions=new ArrayList<QueryBuilder>();
  }
  QueryBuilder queryBuilder=new QueryBuilder().append(columnName).appendSpaceSeparated("String_Node_Str").append(value);
  mSetDefinitions.add(queryBuilder);
  return this;
}
Program: 27233
Project: 27233
Buggy source:
public UpdateTableMigration<ModelClass> where(WhereQueryBuilder.WhereParam whereParam){
  if (mWhereQueryBuilder == null) {
    mWhereQueryBuilder=new WhereQueryBuilder<ModelClass>(mManager,mTable);
  }
  mWhereQueryBuilder.param(whereParam);
}

Fixed version (ground truth):
public UpdateTableMigration<ModelClass> where(WhereQueryBuilder.WhereParam whereParam){
  if (mWhereQueryBuilder == null) {
    mWhereQueryBuilder=new WhereQueryBuilder<ModelClass>(mManager,mTable);
  }
  mWhereQueryBuilder.param(whereParam);
  return this;
}
Program: 27234
Project: 27234
Buggy source:
/** 
 * Specify the database name. The .db is not necessary. This also must match any prepackaged database.
 * @param databaseName The name of the database in private app data
 * @return The builder
 */
public Builder databaseName(String databaseName){
  mConfiguration.mDatabaseName=databaseName;
  return this;
}

Fixed version (ground truth):
/** 
 * Specify the database name. The .db is not necessary. This also must match any prepackaged database.
 * @param databaseName The name of the database in private app data
 * @return The builder
 */
public Builder databaseName(String databaseName){
  mConfiguration.mDatabaseName=databaseName + "String_Node_Str";
  return this;
}