nus-yam/ex-repair huggingface dataset:
Program: 27025
Project: 27025
Buggy source:
/** 
 * Replaces empty parameter values such as "columnName = ?" with the array of values passed in. It must match the count of columns that are in this where query.
 * @param values The values of the fields we wish to replace. Must match the length of the empty params and must be in empty param mode.
 * @return A new {@link ConditionQueryBuilder} with the parameters filled in.
 */
public ConditionQueryBuilder<ModelClass> replaceEmptyParams(Object... values){
  if (!useEmptyParams) {
    throw new IllegalStateException("String_Node_Str" + ConditionQueryBuilder.class.getSimpleName() + "String_Node_Str"+ "String_Node_Str");
  }
  if (conditions.size() != values.length) {
    throw new IllegalArgumentException("String_Node_Str" + modelAdapter.getTableName());
  }
  ConditionQueryBuilder<ModelClass> conditionQueryBuilder=new ConditionQueryBuilder<>(modelAdapter.getModelClass());
  for (int i=0; i < values.length; i++) {
    conditionQueryBuilder.addCondition(conditions.get(i).columnName(),values[i]);
  }
  return conditionQueryBuilder;
}

Fixed version (ground truth):
/** 
 * Replaces empty parameter values such as "columnName = ?" with the array of values passed in. It must match the count of columns that are in this where query.
 * @param values The values of the fields we wish to replace. Must match the length of the empty params and must be in empty param mode.
 * @return A new {@link ConditionQueryBuilder} with the parameters filled in.
 */
public ConditionQueryBuilder<ModelClass> replaceEmptyParams(Object... values){
  if (!useEmptyParams) {
    throw new IllegalStateException("String_Node_Str" + ConditionQueryBuilder.class.getSimpleName() + "String_Node_Str"+ "String_Node_Str");
  }
  if (conditions.size() != values.length) {
    throw new IllegalArgumentException("String_Node_Str" + modelAdapter.getTableName());
  }
  ConditionQueryBuilder<ModelClass> conditionQueryBuilder=new ConditionQueryBuilder<>(modelAdapter.getModelClass());
  for (int i=0; i < values.length; i++) {
    SQLCondition condition=conditions.get(i);
    conditionQueryBuilder.addCondition(column(ColumnAlias.columnRaw(condition.columnName())).operation(condition.operation()).value(values[i]));
  }
  return conditionQueryBuilder;
}
Program: 27026
Project: 27026
Buggy source:
/** 
 * Appends a column to this class. It will append the correct string value based on the   {@link com.raizlabs.android.dbflow.processor.definition.ColumnDefinition}
 * @param column
 * @return
 */
public QueryBuilder appendColumn(ColumnDefinition column){
  if (column.length > -1) {
    query.append("String_Node_Str");
    query.append(column.length);
    query.append("String_Node_Str");
  }
  if (column.isPrimaryKeyAutoIncrement) {
    append("String_Node_Str");
  }
  if (column.notNull) {
    appendSpaceSeparated("String_Node_Str").append(column.onNullConflict.toString());
  }
  if (column.unique) {
    appendSpaceSeparated("String_Node_Str").append(column.onUniqueConflict.toString());
  }
  if (column.collate != null && !column.collate.isEmpty()) {
    appendSpaceSeparated("String_Node_Str").append(column.collate);
  }
  if (column.defaultValue != null && !column.defaultValue.isEmpty()) {
    appendSpaceSeparated("String_Node_Str").append(column.defaultValue);
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Appends a column to this class. It will append the correct string value based on the   {@link com.raizlabs.android.dbflow.processor.definition.ColumnDefinition}
 * @param column
 * @return
 */
public QueryBuilder appendColumn(ColumnDefinition column){
  if (column.length > -1 && !column.isPrimaryKeyAutoIncrement) {
    query.append("String_Node_Str");
    query.append(column.length);
    query.append("String_Node_Str");
  }
  if (column.isPrimaryKeyAutoIncrement) {
    append("String_Node_Str");
  }
  if (column.notNull) {
    appendSpaceSeparated("String_Node_Str").append(column.onNullConflict.toString());
  }
  if (column.unique) {
    appendSpaceSeparated("String_Node_Str").append(column.onUniqueConflict.toString());
  }
  if (column.collate != null && !column.collate.isEmpty()) {
    appendSpaceSeparated("String_Node_Str").append(column.collate);
  }
  if (column.defaultValue != null && !column.defaultValue.isEmpty()) {
    appendSpaceSeparated("String_Node_Str").append(column.defaultValue);
  }
  return this;
}
Program: 27027
Project: 27027
Buggy source:
private String getPrivateGetterMethodName(){
  if (getterName == null || getterName.length() > 0) {
    String newName=referencedColumnFieldName.substring(0,1).toUpperCase() + (referencedColumnFieldName.length() > 1 ? referencedColumnFieldName.substring(1) : "String_Node_Str");
    return "String_Node_Str" + newName + "String_Node_Str";
  }
 else {
    return "String_Node_Str" + getterName + "String_Node_Str";
  }
}

Fixed version (ground truth):
private String getPrivateGetterMethodName(){
  if (getterName == null || getterName.length() == 0) {
    String newName=referencedColumnFieldName.substring(0,1).toUpperCase() + (referencedColumnFieldName.length() > 1 ? referencedColumnFieldName.substring(1) : "String_Node_Str");
    return "String_Node_Str" + newName + "String_Node_Str";
  }
 else {
    if (getterName.startsWith("String_Node_Str")) {
      return getterName + "String_Node_Str";
    }
 else {
      return "String_Node_Str" + getterName + "String_Node_Str";
    }
  }
}
Program: 27028
Project: 27028
Buggy source:
private String getPrivateSetterMethodName(){
  if (setterName == null || setterName.length() > 0) {
    String newName=referencedColumnFieldName.substring(0,1).toUpperCase() + (referencedColumnFieldName.length() > 1 ? referencedColumnFieldName.substring(1) : "String_Node_Str");
    return "String_Node_Str" + newName + "String_Node_Str";
  }
 else {
    return "String_Node_Str" + setterName + "String_Node_Str";
  }
}

Fixed version (ground truth):
private String getPrivateSetterMethodName(){
  if (setterName == null || setterName.length() == 0) {
    String newName=referencedColumnFieldName.substring(0,1).toUpperCase() + (referencedColumnFieldName.length() > 1 ? referencedColumnFieldName.substring(1) : "String_Node_Str");
    return "String_Node_Str" + newName + "String_Node_Str";
  }
 else {
    if (setterName.startsWith("String_Node_Str")) {
      return setterName + "String_Node_Str";
    }
 else {
      return "String_Node_Str" + setterName + "String_Node_Str";
    }
  }
}
Program: 27029
Project: 27029
Buggy source:
public ColumnAccessModel(ColumnDefinition columnDefinition,ForeignKeyReference foreignKeyReference){
  this.fieldIsAModelContainer=columnDefinition.fieldIsModelContainer;
  columnName=columnDefinition.columnName;
  columnFieldActualType=columnDefinition.columnFieldActualType;
  columnFieldName=columnDefinition.columnFieldName;
  columnFieldType=columnDefinition.columnFieldType;
  isPrivate=foreignKeyReference.fieldIsPrivate();
  foreignKeyLocalColumnName=foreignKeyReference.columnName();
  referencedColumnFieldName=columnDefinition.isModel ? foreignKeyReference.foreignColumnName() : columnDefinition.columnFieldName;
  containerKeyName=foreignKeyReference.foreignColumnName();
  isForeignKeyField=true;
  requiresTypeConverter=false;
  TypeMirror castClass=ModelUtils.getTypeMirrorFromAnnotation(foreignKeyReference);
  castedClass=castClass.toString();
  isABlob=false;
  isPrimitive=castClass.getKind().isPrimitive();
  columnFieldBoxedType=columnFieldActualType;
}

Fixed version (ground truth):
public ColumnAccessModel(ColumnDefinition columnDefinition,ForeignKeyReference foreignKeyReference){
  this.fieldIsAModelContainer=columnDefinition.fieldIsModelContainer;
  columnName=columnDefinition.columnName;
  setterName=columnDefinition.setterName;
  getterName=columnDefinition.getterName;
  columnFieldActualType=columnDefinition.columnFieldActualType;
  columnFieldName=columnDefinition.columnFieldName;
  columnFieldType=columnDefinition.columnFieldType;
  isPrivate=foreignKeyReference.fieldIsPrivate();
  foreignKeyLocalColumnName=foreignKeyReference.columnName();
  referencedColumnFieldName=columnDefinition.isModel ? foreignKeyReference.foreignColumnName() : columnDefinition.columnFieldName;
  containerKeyName=foreignKeyReference.foreignColumnName();
  isForeignKeyField=true;
  requiresTypeConverter=false;
  TypeMirror castClass=ModelUtils.getTypeMirrorFromAnnotation(foreignKeyReference);
  castedClass=castClass.toString();
  isABlob=false;
  isPrimitive=castClass.getKind().isPrimitive();
  columnFieldBoxedType=columnFieldActualType;
}
Program: 27030
Project: 27030
Buggy source:
@Override public synchronized void init(ProcessingEnvironment processingEnv){
  super.init(processingEnv);
  manager=new ProcessorManager(processingEnv);
  manager.addHandlers(new MigrationHandler(),new TypeConverterHandler(),new DatabaseHandler(),new TableHandler(),new ModelContainerHandler(),new ModelViewHandler(),new ContentProviderHandler(),new TableEndpointHandler());
}

Fixed version (ground truth):
@Override public synchronized void init(ProcessingEnvironment processingEnv){
  super.init(processingEnv);
  manager=new ProcessorManager(processingEnv);
  manager.addHandlers(new MigrationHandler(),new TypeConverterHandler(),new DatabaseHandler(),new TableHandler(),new QueryModelHandler(),new ModelContainerHandler(),new ModelViewHandler(),new ContentProviderHandler(),new TableEndpointHandler());
}
Program: 27031
Project: 27031
Buggy source:
@Override public boolean process(Set<? extends TypeElement> annotations,RoundEnvironment roundEnv){
  Set<? extends Element> elements=roundEnv.getElementsAnnotatedWith(Database.class);
  for (  Element element : elements) {
    Database database=element.getAnnotation(Database.class);
    if (database != null) {
      DEFAULT_DB_NAME=database.name();
      break;
    }
  }
  manager.handle(manager,roundEnv);
  return true;
}

Fixed version (ground truth):
@Override public boolean process(Set<? extends TypeElement> annotations,RoundEnvironment roundEnv){
  manager.handle(manager,roundEnv);
  return true;
}
Program: 27032
Project: 27032
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<>();
  supportedTypes.add(Table.class.getName());
  supportedTypes.add(Column.class.getName());
  supportedTypes.add(TypeConverter.class.getName());
  supportedTypes.add(ModelContainer.class.getName());
  supportedTypes.add(ModelView.class.getName());
  supportedTypes.add(Migration.class.getName());
  supportedTypes.add(ContentProvider.class.getName());
  supportedTypes.add(TableEndpoint.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<>();
  supportedTypes.add(Table.class.getName());
  supportedTypes.add(Column.class.getName());
  supportedTypes.add(TypeConverter.class.getName());
  supportedTypes.add(ModelContainer.class.getName());
  supportedTypes.add(ModelView.class.getName());
  supportedTypes.add(Migration.class.getName());
  supportedTypes.add(ContentProvider.class.getName());
  supportedTypes.add(TableEndpoint.class.getName());
  supportedTypes.add(QueryModel.class.getName());
  return supportedTypes;
}
Program: 27033
Project: 27033
Buggy source:
public ContentProviderDefinition(Element typeElement,ProcessorManager processorManager){
  super(typeElement,processorManager);
  ContentProvider provider=element.getAnnotation(ContentProvider.class);
  databaseName=provider.databaseName();
  if (databaseName == null || databaseName.isEmpty()) {
    databaseName=DBFlowProcessor.DEFAULT_DB_NAME;
  }
  DatabaseWriter databaseWriter=manager.getDatabaseWriter(databaseName);
  setDefinitionClassName(databaseWriter.classSeparator + DEFINITION_NAME);
  authority=provider.authority();
  TableEndpointValidator validator=new TableEndpointValidator();
  List<? extends Element> elements=manager.getElements().getAllMembers((TypeElement)typeElement);
  for (  Element innerElement : elements) {
    if (innerElement.getAnnotation(TableEndpoint.class) != null) {
      TableEndpointDefinition endpointDefinition=new TableEndpointDefinition(innerElement,manager);
      if (validator.validate(processorManager,endpointDefinition)) {
        endpointDefinitions.add(endpointDefinition);
      }
    }
  }
  mWriters=new FlowWriter[]{new QueryWriter(this,manager),new InsertWriter(this),new DeleteWriter(this,manager),new UpdateWriter(this,manager)};
}

Fixed version (ground truth):
public ContentProviderDefinition(Element typeElement,ProcessorManager processorManager){
  super(typeElement,processorManager);
  ContentProvider provider=element.getAnnotation(ContentProvider.class);
  databaseName=provider.databaseName();
  DatabaseWriter databaseWriter=manager.getDatabaseWriter(databaseName);
  setDefinitionClassName(databaseWriter.classSeparator + DEFINITION_NAME);
  authority=provider.authority();
  TableEndpointValidator validator=new TableEndpointValidator();
  List<? extends Element> elements=manager.getElements().getAllMembers((TypeElement)typeElement);
  for (  Element innerElement : elements) {
    if (innerElement.getAnnotation(TableEndpoint.class) != null) {
      TableEndpointDefinition endpointDefinition=new TableEndpointDefinition(innerElement,manager);
      if (validator.validate(processorManager,endpointDefinition)) {
        endpointDefinitions.add(endpointDefinition);
      }
    }
  }
  mWriters=new FlowWriter[]{new QueryWriter(this,manager),new InsertWriter(this),new DeleteWriter(this,manager),new UpdateWriter(this,manager)};
}
Program: 27034
Project: 27034
Buggy source:
public MigrationDefinition(ProcessorManager processorManager,TypeElement typeElement){
  super(typeElement,processorManager);
  setDefinitionClassName("String_Node_Str");
  Migration migration=typeElement.getAnnotation(Migration.class);
  this.databaseName=migration.databaseName();
  if (databaseName == null || databaseName.isEmpty()) {
    databaseName=DBFlowProcessor.DEFAULT_DB_NAME;
  }
  version=migration.version();
}

Fixed version (ground truth):
public MigrationDefinition(ProcessorManager processorManager,TypeElement typeElement){
  super(typeElement,processorManager);
  setDefinitionClassName("String_Node_Str");
  Migration migration=typeElement.getAnnotation(Migration.class);
  this.databaseName=migration.databaseName();
  version=migration.version();
}
Program: 27040
Project: 27040
Buggy source:
public static String getClassFromAnnotation(ForeignKeyReference annotation){
  String clazz=null;
  if (annotation != null) {
    try {
      annotation.columnType();
    }
 catch (    MirroredTypeException mte) {
      clazz=mte.getTypeMirror().toString();
    }
  }
  return clazz;
}

Fixed version (ground truth):
public static String getClassFromAnnotation(ForeignKey annotation){
  String clazz=null;
  if (annotation != null) {
    try {
      annotation.tableClass();
    }
 catch (    MirroredTypeException mte) {
      clazz=mte.getTypeMirror().toString();
    }
  }
  return clazz;
}
Program: 27043
Project: 27043
Buggy source:
public void testNullForeignKey() throws JSONException {
  Delete.tables(TestModelContainerClass.class,ParentModel.class);
  JSONObject jsonObject=new JSONObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  JSONModel<TestModelContainerClass> jsonModel=new JSONModel<>(jsonObject,TestModelContainerClass.class);
  jsonModel.save(false);
}

Fixed version (ground truth):
public void testNullForeignKey() throws JSONException {
  Delete.tables(TestModelContainerClass.class,ParentModel.class);
  JSONObject jsonObject=new JSONObject("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  JSONModel<TestModelContainerClass> jsonModel=new JSONModel<>(jsonObject,TestModelContainerClass.class);
  jsonModel.save();
}
Program: 27044
Project: 27044
Buggy source:
public void testBlob(){
  BlobModel blobModel=new BlobModel();
  blobModel.blob=new Blob(TEST_BLOB.getBytes());
  blobModel.save(false);
  assertTrue(blobModel.exists());
  BlobModel model=new Select().from(BlobModel.class).where(Condition.column(BlobModel$Table.KEY).is(blobModel.key)).querySingle();
  assertNotNull(model);
  assertNotNull(model.blob);
  assertEquals(new String(model.blob.getBlob()),TEST_BLOB);
}

Fixed version (ground truth):
public void testBlob(){
  BlobModel blobModel=new BlobModel();
  blobModel.blob=new Blob(TEST_BLOB.getBytes());
  blobModel.save();
  assertTrue(blobModel.exists());
  BlobModel model=new Select().from(BlobModel.class).where(Condition.column(BlobModel$Table.KEY).is(blobModel.key)).querySingle();
  assertNotNull(model);
  assertNotNull(model.blob);
  assertEquals(new String(model.blob.getBlob()),TEST_BLOB);
}
Program: 27045
Project: 27045
Buggy source:
@Override public void onWriteDefinition(JavaWriter javaWriter) throws IOException {
  javaWriter.emitField("String_Node_Str","String_Node_Str",Sets.newHashSet(Modifier.PRIVATE,Modifier.FINAL),"String_Node_Str");
  javaWriter.emitEmptyLine();
  javaWriter.beginConstructor(Sets.newHashSet(Modifier.PUBLIC));
  for (  ColumnDefinition columnDefinition : tableDefinition.columnDefinitions) {
    javaWriter.emitStatement("String_Node_Str","String_Node_Str",columnDefinition.columnName,columnDefinition.columnFieldType);
  }
  javaWriter.endConstructor();
  javaWriter.emitEmptyLine();
  javaWriter.emitAnnotation(Override.class);
  WriterUtils.emitMethod(javaWriter,new FlowWriter(){
    @Override public void write(    JavaWriter javaWriter) throws IOException {
      javaWriter.emitStatement("String_Node_Str","String_Node_Str","String_Node_Str");
    }
  }
,"String_Node_Str","String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL),"String_Node_Str","String_Node_Str");
  InternalAdapterHelper.writeGetModelClass(javaWriter,getModelClassQualifiedName());
  InternalAdapterHelper.writeGetTableName(javaWriter,elementClassName + tableDefinition.databaseWriter.classSeparator + TableDefinition.DBFLOW_TABLE_TAG);
  for (  FlowWriter writer : mMethodWriters) {
    writer.write(javaWriter);
  }
}

Fixed version (ground truth):
@Override public void onWriteDefinition(JavaWriter javaWriter) throws IOException {
  javaWriter.emitField("String_Node_Str","String_Node_Str",Sets.newHashSet(Modifier.PRIVATE,Modifier.FINAL),"String_Node_Str");
  javaWriter.emitEmptyLine();
  javaWriter.beginConstructor(Sets.newHashSet(Modifier.PUBLIC));
  for (  ColumnDefinition columnDefinition : tableDefinition.columnDefinitions) {
    javaWriter.emitStatement("String_Node_Str","String_Node_Str",columnDefinition.columnName,columnDefinition.columnFieldType);
  }
  javaWriter.endConstructor();
  javaWriter.emitEmptyLine();
  javaWriter.emitAnnotation(Override.class);
  WriterUtils.emitMethod(javaWriter,new FlowWriter(){
    @Override public void write(    JavaWriter javaWriter) throws IOException {
      javaWriter.emitStatement("String_Node_Str","String_Node_Str","String_Node_Str");
    }
  }
,"String_Node_Str","String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL),"String_Node_Str","String_Node_Str");
  InternalAdapterHelper.writeGetModelClass(javaWriter,getModelClassQualifiedName());
  InternalAdapterHelper.writeGetTableName(javaWriter,elementClassName + tableDefinition.databaseWriter.classSeparator + TableDefinition.DBFLOW_TABLE_TAG);
  for (  FlowWriter writer : methodWriters) {
    writer.write(javaWriter);
  }
}
Program: 27046
Project: 27046
Buggy source:
public ModelContainerDefinition(TypeElement classElement,ProcessorManager manager){
  super(classElement,manager);
  tableDefinition=manager.getTableDefinition(manager.getDatabase(classElement.getSimpleName().toString()),classElement);
  setDefinitionClassName(tableDefinition.databaseWriter.classSeparator + DBFLOW_MODEL_CONTAINER_TAG);
  mMethodWriters=new FlowWriter[]{new SQLiteStatementWriter(tableDefinition,true,tableDefinition.implementsSqlStatementListener,tableDefinition.implementsContentValuesListener),new ExistenceWriter(tableDefinition,true),new WhereQueryWriter(tableDefinition,true),new ToModelWriter(tableDefinition,true),new LoadCursorWriter(tableDefinition,true,tableDefinition.implementsLoadFromCursorListener)};
}

Fixed version (ground truth):
public ModelContainerDefinition(TypeElement classElement,ProcessorManager manager){
  super(classElement,manager);
  tableDefinition=manager.getTableDefinition(manager.getDatabase(classElement.getSimpleName().toString()),classElement);
  setDefinitionClassName(tableDefinition.databaseWriter.classSeparator + DBFLOW_MODEL_CONTAINER_TAG);
  methodWriters=new FlowWriter[]{new SQLiteStatementWriter(tableDefinition,true,tableDefinition.implementsSqlStatementListener,tableDefinition.implementsContentValuesListener),new ExistenceWriter(tableDefinition,true),new WhereQueryWriter(tableDefinition,true),new ToModelWriter(tableDefinition,true),new LoadCursorWriter(tableDefinition,true,tableDefinition.implementsLoadFromCursorListener)};
}
Program: 27047
Project: 27047
Buggy source:
public QueryModelDefinition(Element typeElement,ProcessorManager processorManager){
  super(typeElement,processorManager);
  QueryModel queryModel=typeElement.getAnnotation(QueryModel.class);
  databaseName=queryModel.databaseName();
  databaseWriter=manager.getDatabaseWriter(databaseName);
  allFields=queryModel.allFields();
  adapterName=getModelClassName() + databaseWriter.classSeparator + DBFLOW_TABLE_ADAPTER;
  implementsLoadFromCursorListener=ProcessorUtils.implementsClass(manager.getProcessingEnvironment(),Classes.LOAD_FROM_CURSOR_LISTENER,(TypeElement)element);
  setDefinitionClassName(databaseWriter.classSeparator + DBFLOW_QUERY_MODEL_TAG);
  mMethodWriters=new FlowWriter[]{new LoadCursorWriter(this,false,implementsLoadFromCursorListener)};
  createColumnDefinitions(((TypeElement)typeElement));
}

Fixed version (ground truth):
public QueryModelDefinition(Element typeElement,ProcessorManager processorManager){
  super(typeElement,processorManager);
  QueryModel queryModel=typeElement.getAnnotation(QueryModel.class);
  databaseName=queryModel.databaseName();
  databaseWriter=manager.getDatabaseWriter(databaseName);
  allFields=queryModel.allFields();
  adapterName=getModelClassName() + databaseWriter.classSeparator + DBFLOW_TABLE_ADAPTER;
  processorManager.addModelToDatabase(getQualifiedModelClassName(),databaseName);
  implementsLoadFromCursorListener=ProcessorUtils.implementsClass(manager.getProcessingEnvironment(),Classes.LOAD_FROM_CURSOR_LISTENER,(TypeElement)element);
  setDefinitionClassName(databaseWriter.classSeparator + DBFLOW_QUERY_MODEL_TAG);
  mMethodWriters=new FlowWriter[]{new LoadCursorWriter(this,false,implementsLoadFromCursorListener)};
  createColumnDefinitions(((TypeElement)typeElement));
}
Program: 27048
Project: 27048
Buggy source:
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.QUERY_MODEL_ADAPTER,Classes.CURSOR);
  javaWriter.emitSingleLineComment("String_Node_Str",databaseName);
  javaWriter.beginType(adapterName,"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL),"String_Node_Str" + element.getSimpleName() + "String_Node_Str");
  for (  FlowWriter writer : mMethodWriters) {
    writer.write(javaWriter);
  }
  WriterUtils.emitOverriddenMethod(javaWriter,new FlowWriter(){
    @Override public void write(    JavaWriter javaWriter) throws IOException {
      javaWriter.emitStatement("String_Node_Str",getQualifiedModelClassName());
    }
  }
,getQualifiedModelClassName(),"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL));
  javaWriter.endType();
  javaWriter.close();
}

Fixed version (ground truth):
public void writeAdapter(ProcessingEnvironment processingEnvironment) throws IOException {
  JavaWriter javaWriter=new JavaWriter(processingEnvironment.getFiler().createSourceFile(getQualifiedAdapterName()).openWriter());
  javaWriter.emitPackage(packageName);
  javaWriter.emitImports(Classes.QUERY_MODEL_ADAPTER,Classes.CURSOR);
  javaWriter.emitSingleLineComment("String_Node_Str",databaseName);
  javaWriter.beginType(adapterName,"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL),"String_Node_Str" + element.getSimpleName() + "String_Node_Str");
  for (  FlowWriter writer : mMethodWriters) {
    writer.write(javaWriter);
  }
  WriterUtils.emitOverriddenMethod(javaWriter,new FlowWriter(){
    @Override public void write(    JavaWriter javaWriter) throws IOException {
      javaWriter.emitStatement("String_Node_Str",getQualifiedModelClassName());
    }
  }
,getQualifiedModelClassName(),"String_Node_Str",Sets.newHashSet(Modifier.PUBLIC,Modifier.FINAL));
  javaWriter.endType();
  javaWriter.close();
}
Program: 27049
Project: 27049
Buggy source:
@Override protected void onProcessElement(ProcessorManager processorManager,Element element){
  QueryModelDefinition queryModelDefinition=new QueryModelDefinition(element,processorManager);
  WriterUtils.writeBaseDefinition(queryModelDefinition,processorManager);
  try {
    queryModelDefinition.writeAdapter(processorManager.getProcessingEnvironment());
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override protected void onProcessElement(ProcessorManager processorManager,Element element){
  QueryModelDefinition queryModelDefinition=new QueryModelDefinition(element,processorManager);
  processorManager.addQueryModelDefinition(queryModelDefinition);
  WriterUtils.writeBaseDefinition(queryModelDefinition,processorManager);
  try {
    queryModelDefinition.writeAdapter(processorManager.getProcessingEnvironment());
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 27051
Project: 27051
Buggy source:
public void testCacheableModel2(){
  Delete.table(CacheableModel2.class);
  CacheableModel2 model=new CacheableModel2();
  ModelCache<CacheableModel2,?> modelCache=BaseCacheableModel.getCache((Class<CacheableModel2>)model.getClass());
  for (int i=0; i < 100; i++) {
    model.id=i;
    model.save();
    long id=model.id;
    CacheableModel2 cacheableModel=modelCache.get(id);
    assertNotNull(cacheableModel);
    assertEquals(new Select().from(CacheableModel2.class).where(Condition.column(CacheableModel$Table.NAME).is(id)).querySingle(),cacheableModel);
    model.delete();
    assertNull(modelCache.get(id));
  }
  Delete.table(CacheableModel2.class);
}

Fixed version (ground truth):
public void testCacheableModel2(){
  Delete.table(CacheableModel2.class);
  CacheableModel2 model=new CacheableModel2();
  ModelCache<CacheableModel2,?> modelCache=BaseCacheableModel.getCache((Class<CacheableModel2>)model.getClass());
  for (int i=0; i < 100; i++) {
    model.id=i;
    model.save();
    long id=model.id;
    CacheableModel2 cacheableModel=modelCache.get(id);
    assertNotNull(cacheableModel);
    assertEquals(new Select().from(CacheableModel2.class).where(Condition.column(CacheableModel2$Table.ID).is(id)).querySingle(),cacheableModel);
    model.delete();
    assertNull(modelCache.get(id));
  }
  Delete.table(CacheableModel2.class);
}
Program: 27052
Project: 27052
Buggy source:
@Override public String getQuery(){
  QueryBuilder queryBuilder=new QueryBuilder("String_Node_Str");
  if (mConflictAction != null && !mConflictAction.equals(ConflictAction.NONE)) {
    queryBuilder.append("String_Node_Str").appendSpaceSeparated(mConflictAction.name());
  }
  queryBuilder.append(FlowManager.getTableName(mTable)).appendSpace();
  return queryBuilder.getQuery();
}

Fixed version (ground truth):
@Override public String getQuery(){
  QueryBuilder queryBuilder=new QueryBuilder("String_Node_Str");
  if (mConflictAction != null && !mConflictAction.equals(ConflictAction.NONE)) {
    queryBuilder.append("String_Node_Str").appendSpaceSeparated(mConflictAction.name());
  }
  queryBuilder.appendQuoted(FlowManager.getTableName(mTable)).appendSpace();
  return queryBuilder.getQuery();
}
Program: 27053
Project: 27053
Buggy source:
@Override public boolean exists(){
  return mModelAdapter.exists(toModel());
}

Fixed version (ground truth):
@Override public boolean exists(){
  ModelClass model=toModel();
  return model != null && mModelAdapter.exists(model);
}
Program: 27054
Project: 27054
Buggy source:
public void testIsOperators(){
  ConditionQueryBuilder<ConditionModel> conditionQueryBuilder=new ConditionQueryBuilder<>(ConditionModel.class);
  conditionQueryBuilder.putCondition(Condition.column(ConditionModel$Table.NAME).is("String_Node_Str")).or(Condition.column(ConditionModel$Table.FRACTION).isNotNull());
  assertEquals("String_Node_Str",conditionQueryBuilder.getQuery().trim());
}

Fixed version (ground truth):
public void testIsOperators(){
  ConditionQueryBuilder<ConditionModel> conditionQueryBuilder=new ConditionQueryBuilder<>(ConditionModel.class);
  conditionQueryBuilder.addCondition(Condition.column(ConditionModel$Table.NAME).is("String_Node_Str")).or(Condition.column(ConditionModel$Table.FRACTION).isNotNull());
  assertEquals("String_Node_Str",conditionQueryBuilder.getQuery().trim());
}
Program: 27055
Project: 27055
Buggy source:
public void testChainingConditions(){
  ConditionQueryBuilder<ConditionModel> conditionQueryBuilder=new ConditionQueryBuilder<>(ConditionModel.class);
  conditionQueryBuilder.putCondition(Condition.column(ConditionModel$Table.NAME).is("String_Node_Str").separator("String_Node_Str")).putCondition(Condition.column(ConditionModel$Table.NUMBER).is(6).separator("String_Node_Str")).putCondition(Condition.column(ConditionModel$Table.FRACTION).is(4.5d));
  assertEquals("String_Node_Str",conditionQueryBuilder.getQuery().trim());
}

Fixed version (ground truth):
public void testChainingConditions(){
  ConditionQueryBuilder<ConditionModel> conditionQueryBuilder=new ConditionQueryBuilder<>(ConditionModel.class);
  conditionQueryBuilder.addCondition(Condition.column(ConditionModel$Table.NAME).is("String_Node_Str").separator("String_Node_Str")).addCondition(Condition.column(ConditionModel$Table.NUMBER).is(6).separator("String_Node_Str")).addCondition(Condition.column(ConditionModel$Table.FRACTION).is(4.5d));
  assertEquals("String_Node_Str",conditionQueryBuilder.getQuery().trim());
}
Program: 27056
Project: 27056
Buggy source:
/** 
 * This test will ensure that all column values are converted appropriately
 */
public void testConditions(){
  ConditionQueryBuilder<ConditionModel> conditionQueryBuilder=new ConditionQueryBuilder<>(ConditionModel.class);
  conditionQueryBuilder.putConditions(Condition.column("String_Node_Str").is(5L),Condition.column("String_Node_Str").is(5),Condition.column("String_Node_Str").is(6.5d));
  assertEquals("String_Node_Str",conditionQueryBuilder.getQuery());
  conditionQueryBuilder=new ConditionQueryBuilder<>(ConditionModel.class).putCondition(Condition.column(ConditionModel$Table.NUMBER).between(5L).and(10L));
  assertEquals("String_Node_Str",conditionQueryBuilder.getQuery().trim());
}

Fixed version (ground truth):
/** 
 * This test will ensure that all column values are converted appropriately
 */
public void testConditions(){
  ConditionQueryBuilder<ConditionModel> conditionQueryBuilder=new ConditionQueryBuilder<>(ConditionModel.class);
  conditionQueryBuilder.addConditions(Condition.column("String_Node_Str").is(5L),Condition.column("String_Node_Str").is(5),Condition.column("String_Node_Str").is(6.5d));
  assertEquals("String_Node_Str",conditionQueryBuilder.getQuery());
  conditionQueryBuilder=new ConditionQueryBuilder<>(ConditionModel.class).addCondition(Condition.column(ConditionModel$Table.NUMBER).between(5L).and(10L));
  assertEquals("String_Node_Str",conditionQueryBuilder.getQuery().trim());
}
Program: 27057
Project: 27057
Buggy source:
public void testInsert(){
  Delete.table(InsertModel.class);
  Insert<InsertModel> insert=new Insert<>(InsertModel.class).orFail().columns(InsertModel$Table.NAME,InsertModel$Table.VALUE).values("String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",insert.getQuery());
  FlowManager.getDatabase(TestDatabase.NAME).getWritableDatabase().execSQL(insert.getQuery());
  InsertModel model=new Select().from(InsertModel.class).where(Condition.column(InsertModel$Table.NAME).is("String_Node_Str")).querySingle();
  assertNotNull(model);
  insert=new Insert<>(InsertModel.class).orAbort().values("String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",insert.getQuery());
  FlowManager.getDatabase(TestDatabase.NAME).getWritableDatabase().execSQL(insert.getQuery());
  model=new Select().from(InsertModel.class).where(Condition.column(InsertModel$Table.NAME).is("String_Node_Str")).querySingle();
  assertNotNull(model);
}

Fixed version (ground truth):
public void testInsert(){
  Delete.table(InsertModel.class);
  Insert<InsertModel> insert=Insert.into(InsertModel.class).orFail().columns(InsertModel$Table.NAME,InsertModel$Table.VALUE).values("String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",insert.getQuery());
  FlowManager.getDatabase(TestDatabase.NAME).getWritableDatabase().execSQL(insert.getQuery());
  InsertModel model=new Select().from(InsertModel.class).where(Condition.column(InsertModel$Table.NAME).is("String_Node_Str")).querySingle();
  assertNotNull(model);
  insert=Insert.into(InsertModel.class).orAbort().values("String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",insert.getQuery());
  FlowManager.getDatabase(TestDatabase.NAME).getWritableDatabase().execSQL(insert.getQuery());
  model=new Select().from(InsertModel.class).where(Condition.column(InsertModel$Table.NAME).is("String_Node_Str")).querySingle();
  assertNotNull(model);
}
Program: 27058
Project: 27058
Buggy source:
public void testSubquery(){
  String query=new Select().from(BoxedModel.class).where().exists().subQuery().from(BoxedModel.class).where(Condition.columnRaw(BoxedModel$Table.INTEGERFIELD).eq(BoxedModel$Table.INTEGERFIELDNOTNULL)).getQuery();
  assertEquals("String_Node_Str",query.trim());
}

Fixed version (ground truth):
public void testSubquery(){
  String query=new Select().from(BoxedModel.class).where().exists(new Select().from(BoxedModel.class).where(Condition.columnRaw(BoxedModel$Table.INTEGERFIELD).eq(BoxedModel$Table.INTEGERFIELDNOTNULL))).getQuery();
  assertEquals("String_Node_Str",query.trim());
}
Program: 27060
Project: 27060
Buggy source:
@Override public void write(JavaWriter javaWriter) throws IOException {
  AtomicInteger columnCounter=new AtomicInteger(1);
  for (int i=0; i < tableDefinition.getColumnDefinitions().size(); i++) {
    ColumnDefinition columnDefinition=tableDefinition.getColumnDefinitions().get(i);
    if (columnDefinition.columnType != Column.PRIMARY_KEY_AUTO_INCREMENT) {
      columnDefinition.writeSaveDefinition(javaWriter,isModelContainer,true,columnCounter);
    }
    if (implementsContentValuesListener) {
      javaWriter.emitStatement("String_Node_Str",args[3],args[1]);
    }
  }
  javaWriter.emitEmptyLine();
}

Fixed version (ground truth):
@Override public void write(JavaWriter javaWriter) throws IOException {
  AtomicInteger columnCounter=new AtomicInteger(1);
  for (int i=0; i < tableDefinition.getColumnDefinitions().size(); i++) {
    ColumnDefinition columnDefinition=tableDefinition.getColumnDefinitions().get(i);
    columnDefinition.writeSaveDefinition(javaWriter,isModelContainer,true,columnCounter);
    if (implementsContentValuesListener) {
      javaWriter.emitStatement("String_Node_Str",args[3],args[1]);
    }
  }
  javaWriter.emitEmptyLine();
}
Program: 27061
Project: 27061
Buggy source:
public void testModelAutoIncrement(){
  TestModelAI testModelAI=new TestModelAI();
  testModelAI.name="String_Node_Str";
  testModelAI.save(false);
  assertTrue(testModelAI.exists());
  testModelAI.delete(false);
  assertTrue(!testModelAI.exists());
}

Fixed version (ground truth):
public void testModelAutoIncrement(){
  TestModelAI testModelAI=new TestModelAI();
  testModelAI.name="String_Node_Str";
  testModelAI.insert(false);
  assertTrue(testModelAI.exists());
  TestModelAI testModelAI2=new TestModelAI();
  testModelAI2.id=testModelAI.id;
  testModelAI2.name="String_Node_Str";
  testModelAI2.update(false);
  TestModelAI testModelAI3=Select.byId(TestModelAI.class,testModelAI.id);
  assertEquals(testModelAI3.name,testModelAI2.name);
  testModelAI.delete(false);
  assertTrue(!testModelAI.exists());
}
Program: 27062
Project: 27062
Buggy source:
/** 
 * @return The autoincrement column name for the {@link com.raizlabs.android.dbflow.annotation.Column#PRIMARY_KEY_AUTO_INCREMENT}if it has the field. This method is overridden when its specified for the   {@link ModelClass}
 */
public String getAutoIncrementingColumnName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * @return The autoincrement column name for the {@link com.raizlabs.android.dbflow.annotation.Column#PRIMARY_KEY_AUTO_INCREMENT}if it has the field. This method is overridden when its specified for the   {@link ModelClass}
 */
public String getAutoIncrementingColumnName(){
  throw new InvalidDBConfiguration(String.format("String_Node_Str" + "String_Node_Str",getModelClass()));
}
Program: 27063
Project: 27063
Buggy source:
/** 
 * @return The value for the {@link com.raizlabs.android.dbflow.annotation.Column#PRIMARY_KEY_AUTO_INCREMENT}if it has the field. This method is overridden when its specified for the   {@link ModelClass}
 */
@Override public long getAutoIncrementingId(ModelClass model){
  return 0;
}

Fixed version (ground truth):
/** 
 * @return The value for the {@link com.raizlabs.android.dbflow.annotation.Column#PRIMARY_KEY_AUTO_INCREMENT}if it has the field. This method is overridden when its specified for the   {@link ModelClass}
 */
@Override public long getAutoIncrementingId(ModelClass model){
  throw new InvalidDBConfiguration(String.format("String_Node_Str" + "String_Node_Str",getModelClass()));
}
Program: 27064
Project: 27064
Buggy source:
@SuppressWarnings("String_Node_Str") protected void addToCache(){
  long id=getModelAdapter().getCachingId(this);
  if (id == 0) {
    throw new InvalidDBConfiguration(String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",getClass()));
  }
 else {
    mCache.addModel(id,this);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected void addToCache(){
  mCache.addModel(getModelAdapter().getCachingId(this),this);
}
Program: 27065
Project: 27065
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public void delete(boolean async){
  long id=getModelAdapter().getAutoIncrementingId(this);
  super.delete(async);
  if (!async) {
    mCache.removeModel(id);
  }
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public void delete(boolean async){
  long id=getModelAdapter().getCachingId(this);
  super.delete(async);
  if (!async) {
    mCache.removeModel(id);
  }
}
Program: 27066
Project: 27066
Buggy source:
public ContentProviderDefinition(Element typeElement,ProcessorManager processorManager){
  super(typeElement,processorManager);
  setDefinitionClassName(DEFINITION_NAME);
  ContentProvider provider=element.getAnnotation(ContentProvider.class);
  databaseName=provider.databaseName();
  if (databaseName == null || databaseName.isEmpty()) {
    databaseName=DBFlowProcessor.DEFAULT_DB_NAME;
  }
  authority=provider.authority();
  TableEndpointValidator validator=new TableEndpointValidator();
  List<? extends Element> elements=manager.getElements().getAllMembers((TypeElement)typeElement);
  for (  Element innerElement : elements) {
    if (innerElement.getAnnotation(TableEndpoint.class) != null) {
      TableEndpointDefinition endpointDefinition=new TableEndpointDefinition(innerElement,manager);
      if (validator.validate(processorManager,endpointDefinition)) {
        endpointDefinitions.add(endpointDefinition);
      }
    }
  }
  mWriters=new FlowWriter[]{new QueryWriter(this),new InsertWriter(this),new DeleteWriter(this),new UpdateWriter(this)};
}

Fixed version (ground truth):
public ContentProviderDefinition(Element typeElement,ProcessorManager processorManager){
  super(typeElement,processorManager);
  setDefinitionClassName(DEFINITION_NAME);
  ContentProvider provider=element.getAnnotation(ContentProvider.class);
  databaseName=provider.databaseName();
  if (databaseName == null || databaseName.isEmpty()) {
    databaseName=DBFlowProcessor.DEFAULT_DB_NAME;
  }
  authority=provider.authority();
  TableEndpointValidator validator=new TableEndpointValidator();
  List<? extends Element> elements=manager.getElements().getAllMembers((TypeElement)typeElement);
  for (  Element innerElement : elements) {
    if (innerElement.getAnnotation(TableEndpoint.class) != null) {
      TableEndpointDefinition endpointDefinition=new TableEndpointDefinition(innerElement,manager);
      if (validator.validate(processorManager,endpointDefinition)) {
        endpointDefinitions.add(endpointDefinition);
      }
    }
  }
  mWriters=new FlowWriter[]{new QueryWriter(this,manager),new InsertWriter(this),new DeleteWriter(this,manager),new UpdateWriter(this,manager)};
}
Program: 27067
Project: 27067
Buggy source:
@Override protected void createColumnDefinitions(TypeElement element){
  List<? extends Element> variableElements=manager.getElements().getAllMembers(element);
  ColumnValidator columnValidator=new ColumnValidator();
  for (  Element variableElement : variableElements) {
    boolean isValidColumn=allFields && (variableElement.getKind().isField() && !variableElement.getModifiers().contains(Modifier.STATIC) && !variableElement.getModifiers().contains(Modifier.PRIVATE)&& !variableElement.getModifiers().contains(Modifier.FINAL));
    if (variableElement.getAnnotation(Column.class) != null || isValidColumn) {
      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;
          hasAutoIncrement=true;
        }
      }
    }
  }
}

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) {
    boolean isValidColumn=allFields && (variableElement.getKind().isField() && !variableElement.getModifiers().contains(Modifier.STATIC) && !variableElement.getModifiers().contains(Modifier.PRIVATE)&& !variableElement.getModifiers().contains(Modifier.FINAL));
    if (variableElement.getAnnotation(Column.class) != null || isValidColumn) {
      ColumnDefinition columnDefinition=new ColumnDefinition(manager,(VariableElement)variableElement);
      if (columnValidator.validate(manager,columnDefinition)) {
        columnDefinitions.add(columnDefinition);
        mColumnMap.put(columnDefinition.columnName,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;
          hasAutoIncrement=true;
        }
      }
    }
  }
}
Program: 27068
Project: 27068
Buggy source:
public TableDefinition getTableDefinition(String databaseName,TypeElement typeElement){
  return mTableDefinitions.get(databaseName).get(typeElement.getQualifiedName().toString());
}

Fixed version (ground truth):
public TableDefinition getTableDefinition(String databaseName,String tableName){
  return mTableNameDefinitionMap.get(databaseName).get(tableName);
}
Program: 27069
Project: 27069
Buggy source:
public void addTableDefinition(TableDefinition modelContainerDefinition){
  Map<String,TableDefinition> tableDefinitionMap=mTableDefinitions.get(modelContainerDefinition.databaseName);
  if (tableDefinitionMap == null) {
    tableDefinitionMap=Maps.newHashMap();
    mTableDefinitions.put(modelContainerDefinition.databaseName,tableDefinitionMap);
  }
  tableDefinitionMap.put(modelContainerDefinition.element.asType().toString(),modelContainerDefinition);
}

Fixed version (ground truth):
public void addTableDefinition(TableDefinition tableDefinition){
  Map<String,TableDefinition> tableDefinitionMap=mTableDefinitions.get(tableDefinition.databaseName);
  if (tableDefinitionMap == null) {
    tableDefinitionMap=Maps.newHashMap();
    mTableDefinitions.put(tableDefinition.databaseName,tableDefinitionMap);
  }
  Map<String,TableDefinition> tableNameMap=mTableNameDefinitionMap.get(tableDefinition.databaseName);
  if (tableNameMap == null) {
    tableNameMap=Maps.newHashMap();
    mTableNameDefinitionMap.put(tableDefinition.databaseName,tableNameMap);
  }
  tableDefinitionMap.put(tableDefinition.element.asType().toString(),tableDefinition);
  tableNameMap.put(tableDefinition.tableName,tableDefinition);
}
Program: 27070
Project: 27070
Buggy source:
public SqlQueryBuilder appendPathSegments(ContentUri.PathSegment[] pathSegments){
  for (  ContentUri.PathSegment pathSegment : pathSegments) {
    append(String.format("String_Node_Str",pathSegment.column(),pathSegment.segment()));
  }
  return this;
}

Fixed version (ground truth):
public SqlQueryBuilder appendPathSegments(ProcessorManager processorManager,String databaseName,String tableName,ContentUri.PathSegment[] pathSegments){
  TableDefinition tableDefinition=processorManager.getTableDefinition(databaseName,tableName);
  if (tableDefinition == null) {
    processorManager.logError("String_Node_Str",tableName,databaseName);
  }
  for (  ContentUri.PathSegment pathSegment : pathSegments) {
    ColumnDefinition columnDefinition=tableDefinition.mColumnMap.get(pathSegment.column());
    if (columnDefinition == null) {
      processorManager.logError("String_Node_Str",pathSegment.column(),tableDefinition.tableName);
    }
 else {
      append(String.format("String_Node_Str",pathSegment.column()));
      if (columnDefinition.element.asType().getKind().isPrimitive()) {
        String name=columnDefinition.element.asType().toString();
        name=name.substring(0,1).toUpperCase() + name.substring(1);
        append(String.format("String_Node_Str",name,pathSegment.segment()));
      }
 else {
        append(String.format("String_Node_Str",pathSegment.segment()));
      }
    }
  }
  return this;
}