Program: 27038
Project: 27038
Buggy source:
public void writeLoadFromCursorDefinition(BaseTableDefinition tableDefinition,JavaWriter javaWriter,boolean isModelContainerAdapter) throws IOException {
  if (isForeignKey) {
    javaWriter.emitEmptyLine();
    javaWriter.emitSingleLineComment("String_Node_Str",columnFieldName);
    if (!fieldIsModelContainer && !isModelContainerAdapter && isModel) {
      for (      ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
        javaWriter.emitStatement(ModelUtils.getColumnIndex(foreignKeyReference.columnName()));
      }
      ModelUtils.writeColumnIndexCheckers(javaWriter,foreignKeyReferences);
      MockConditionQueryBuilder conditionQueryBuilder=new MockConditionQueryBuilder().appendForeignKeyReferences(columnFieldType + tableDefinition.databaseWriter.classSeparator + TableDefinition.DBFLOW_TABLE_TAG,columnName,foreignKeyReferences);
      String rawConditionStatement=String.format("String_Node_Str",ModelUtils.getFieldClass(columnFieldType),conditionQueryBuilder);
      AdapterQueryBuilder adapterQueryBuilder=new AdapterQueryBuilder().appendVariable(false);
      adapterQueryBuilder.append("String_Node_Str").append(columnFieldName).appendSpaceSeparated("String_Node_Str");
      adapterQueryBuilder.append(rawConditionStatement);
      javaWriter.emitStatement(adapterQueryBuilder.getQuery());
      javaWriter.endControlFlow();
    }
 else {
      if (isModelContainerAdapter) {
        javaWriter.emitSingleLineComment("String_Node_Str");
      }
 else {
        javaWriter.emitSingleLineComment("String_Node_Str");
      }
      for (      ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
        javaWriter.emitStatement(ModelUtils.getColumnIndex(foreignKeyReference.columnName()));
      }
      ModelUtils.writeColumnIndexCheckers(javaWriter,foreignKeyReferences);
      String modelContainerName="String_Node_Str";
      if (isModelContainerAdapter) {
        modelContainerName=ModelUtils.getVariable(isModelContainerAdapter) + columnFieldName;
        javaWriter.emitStatement("String_Node_Str",modelContainerName,ModelUtils.getVariable(true),ModelUtils.getVariable(true),columnFieldType);
      }
 else       if (fieldIsModelContainer) {
        AdapterQueryBuilder containerBuilder=new AdapterQueryBuilder().appendVariable(isModelContainerAdapter).append("String_Node_Str").append(columnFieldName).appendSpaceSeparated("String_Node_Str").append("String_Node_Str").append(columnFieldActualType).appendParenthesisEnclosed(ModelUtils.getFieldClass(columnFieldType));
        javaWriter.emitStatement(containerBuilder.getQuery());
      }
      for (      ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
        ColumnAccessModel columnAccessModel=new ColumnAccessModel(this,foreignKeyReference);
        LoadFromCursorModel loadFromCursorModel=new LoadFromCursorModel(columnAccessModel);
        loadFromCursorModel.setIsNullable(isNullable());
        loadFromCursorModel.setModelContainerName(modelContainerName);
        loadFromCursorModel.setIsModelContainerAdapter(isModelContainerAdapter);
        loadFromCursorModel.write(javaWriter);
      }
      if (isModelContainerAdapter) {
        javaWriter.emitStatement("String_Node_Str",ModelUtils.getVariable(true),columnFieldName,modelContainerName);
        javaWriter.nextControlFlow("String_Node_Str");
        javaWriter.emitStatement("String_Node_Str",ModelUtils.getVariable(true),columnFieldName);
      }
      javaWriter.endControlFlow();
    }
    javaWriter.emitSingleLineComment("String_Node_Str");
    javaWriter.emitEmptyLine();
  }
 else {
    String getType=columnFieldType;
    if (element.asType().getKind().isPrimitive()) {
      getType=manager.getTypeUtils().boxedClass((PrimitiveType)element.asType()).asType().toString();
    }
    ModelUtils.writeLoadFromCursorDefinitionField(javaWriter,manager,getType,columnFieldName,columnName,"String_Node_Str",containerKeyName,modelType,hasTypeConverter,isModelContainerAdapter,this.fieldIsModelContainer,isNullable(),isBlob);
  }
}

Fixed version (ground truth):
public void writeLoadFromCursorDefinition(BaseTableDefinition tableDefinition,JavaWriter javaWriter,boolean isModelContainerAdapter) throws IOException {
  if (isForeignKey) {
    javaWriter.emitEmptyLine();
    javaWriter.emitSingleLineComment("String_Node_Str",columnFieldName);
    if (!fieldIsModelContainer && !isModelContainerAdapter && isModel) {
      for (      ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
        javaWriter.emitStatement(ModelUtils.getColumnIndex(foreignKeyReference.columnName()));
      }
      ModelUtils.writeColumnIndexCheckers(javaWriter,foreignKeyReferences);
      MockConditionQueryBuilder conditionQueryBuilder=new MockConditionQueryBuilder().appendForeignKeyReferences(columnFieldType + tableDefinition.databaseWriter.classSeparator + TableDefinition.DBFLOW_TABLE_TAG,columnName,foreignKeyReferences);
      String rawConditionStatement=String.format("String_Node_Str",ModelUtils.getFieldClass(columnFieldType),conditionQueryBuilder);
      AdapterQueryBuilder adapterQueryBuilder=new AdapterQueryBuilder().appendVariable(false);
      adapterQueryBuilder.append("String_Node_Str").append(columnFieldName).appendSpaceSeparated("String_Node_Str");
      adapterQueryBuilder.append(rawConditionStatement);
      javaWriter.emitStatement(adapterQueryBuilder.getQuery());
      javaWriter.endControlFlow();
    }
 else {
      if (isModelContainerAdapter) {
        javaWriter.emitSingleLineComment("String_Node_Str");
      }
 else {
        javaWriter.emitSingleLineComment("String_Node_Str");
      }
      for (      ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
        javaWriter.emitStatement(ModelUtils.getColumnIndex(foreignKeyReference.columnName()));
      }
      ModelUtils.writeColumnIndexCheckers(javaWriter,foreignKeyReferences);
      String modelContainerName="String_Node_Str";
      if (isModelContainerAdapter) {
        if (isModel) {
          modelContainerName=ModelUtils.getVariable(isModelContainerAdapter) + columnFieldName;
          javaWriter.emitStatement("String_Node_Str",modelContainerName,ModelUtils.getVariable(true),ModelUtils.getVariable(true),foreignKeyTableClassName);
        }
 else {
          modelContainerName=ModelUtils.getVariable(isModelContainerAdapter);
        }
      }
 else       if (fieldIsModelContainer) {
        AdapterQueryBuilder containerBuilder=new AdapterQueryBuilder().appendVariable(isModelContainerAdapter).append("String_Node_Str").append(columnFieldName).appendSpaceSeparated("String_Node_Str").append("String_Node_Str").append(columnFieldActualType).appendParenthesisEnclosed(ModelUtils.getFieldClass(columnFieldType));
        javaWriter.emitStatement(containerBuilder.getQuery());
      }
      for (      ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
        ColumnAccessModel columnAccessModel=new ColumnAccessModel(this,foreignKeyReference);
        LoadFromCursorModel loadFromCursorModel=new LoadFromCursorModel(columnAccessModel);
        loadFromCursorModel.setIsNullable(isNullable());
        loadFromCursorModel.setModelContainerName(modelContainerName);
        loadFromCursorModel.setIsModelContainerAdapter(isModelContainerAdapter);
        loadFromCursorModel.write(javaWriter);
      }
      if (isModelContainerAdapter && isModel && fieldIsModelContainer) {
        javaWriter.emitStatement("String_Node_Str",ModelUtils.getVariable(true),columnFieldName,modelContainerName);
        javaWriter.nextControlFlow("String_Node_Str");
        javaWriter.emitStatement("String_Node_Str",ModelUtils.getVariable(true),columnFieldName);
      }
      javaWriter.endControlFlow();
    }
    javaWriter.emitSingleLineComment("String_Node_Str");
    javaWriter.emitEmptyLine();
  }
 else {
    String getType=columnFieldType;
    if (element.asType().getKind().isPrimitive()) {
      getType=manager.getTypeUtils().boxedClass((PrimitiveType)element.asType()).asType().toString();
    }
    ModelUtils.writeLoadFromCursorDefinitionField(javaWriter,manager,getType,columnFieldName,columnName,"String_Node_Str",containerKeyName,modelType,hasTypeConverter,isModelContainerAdapter,this.fieldIsModelContainer,isNullable(),isBlob);
  }
}