Program: 27155
Project: 27155
Buggy source:
public void writeSaveDefinition(JavaWriter javaWriter,boolean isModelContainerDefinition) throws IOException {
  if (columnType == Column.FOREIGN_KEY && isModel) {
    javaWriter.emitEmptyLine();
    if (isModelContainer) {
      javaWriter.emitSingleLineComment("String_Node_Str");
    }
 else {
      javaWriter.emitSingleLineComment("String_Node_Str");
    }
    if (isModelContainerDefinition) {
      String modelContainerName=ModelUtils.getVariable(true) + columnFieldName;
      javaWriter.emitStatement("String_Node_Str",modelContainerName,ModelUtils.getVariable(true),ModelUtils.getVariable(true),columnFieldName,columnFieldType);
      javaWriter.emitStatement("String_Node_Str",modelContainerName);
      for (      ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
        AdapterQueryBuilder adapterQueryBuilder=new AdapterQueryBuilder();
        adapterQueryBuilder.appendContentValues().appendPut(foreignKeyReference.columnName()).appendCast(ModelUtils.getClassFromAnnotation(foreignKeyReference)).append(modelContainerName).append("String_Node_Str").appendGetValue(foreignKeyReference.foreignColumnName()).append("String_Node_Str");
        javaWriter.emitStatement(adapterQueryBuilder.getQuery());
      }
    }
 else {
      String modelStatement=ModelUtils.getModelStatement(columnFieldName);
      javaWriter.beginControlFlow("String_Node_Str",modelStatement);
      javaWriter.emitStatement("String_Node_Str",modelStatement);
      for (      ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
        javaWriter.emitStatement(ModelUtils.getContentValueStatement(foreignKeyReference.columnName(),columnName,ModelUtils.getClassFromAnnotation(foreignKeyReference),foreignKeyReference.foreignColumnName(),false,isModelContainer,true,false,columnFieldType));
      }
      javaWriter.endControlFlow();
    }
    javaWriter.emitSingleLineComment("String_Node_Str");
    javaWriter.emitEmptyLine();
  }
 else {
    String newFieldType=null;
    if (hasTypeConverter) {
      TypeConverterDefinition typeConverterDefinition=manager.getTypeConverterDefinition(modelType);
      if (typeConverterDefinition == null) {
        manager.getMessager().printMessage(Diagnostic.Kind.ERROR,String.format("String_Node_Str",modelType));
      }
 else {
        newFieldType=typeConverterDefinition.getDbElement().asType().toString();
      }
    }
 else {
      newFieldType=columnFieldType;
    }
    javaWriter.emitStatement(ModelUtils.getContentValueStatement(columnName,columnName,newFieldType,columnFieldName,isModelContainerDefinition,isModelContainer,false,hasTypeConverter,columnFieldType));
  }
}

Fixed version (ground truth):
public void writeSaveDefinition(JavaWriter javaWriter,boolean isModelContainerDefinition) throws IOException {
  if (columnType == Column.FOREIGN_KEY && isModel) {
    javaWriter.emitEmptyLine();
    if (isModelContainer) {
      javaWriter.emitSingleLineComment("String_Node_Str");
    }
 else {
      javaWriter.emitSingleLineComment("String_Node_Str");
    }
    if (isModelContainerDefinition) {
      String modelContainerName=ModelUtils.getVariable(true) + columnFieldName;
      javaWriter.emitStatement("String_Node_Str",modelContainerName,ModelUtils.getVariable(true),ModelUtils.getVariable(true),columnFieldName,columnFieldType);
      javaWriter.emitStatement("String_Node_Str",modelContainerName);
      for (      ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
        AdapterQueryBuilder adapterQueryBuilder=new AdapterQueryBuilder();
        adapterQueryBuilder.appendContentValues().appendPut(foreignKeyReference.columnName()).appendCast(ModelUtils.getClassFromAnnotation(foreignKeyReference)).append(modelContainerName).append("String_Node_Str").appendGetValue(foreignKeyReference.foreignColumnName()).append("String_Node_Str");
        javaWriter.emitStatement(adapterQueryBuilder.getQuery());
      }
    }
 else {
      String modelStatement=ModelUtils.getModelStatement(columnFieldName);
      javaWriter.beginControlFlow("String_Node_Str",modelStatement);
      javaWriter.emitStatement("String_Node_Str",modelStatement);
      for (      ForeignKeyReference foreignKeyReference : foreignKeyReferences) {
        javaWriter.emitStatement(ModelUtils.getContentValueStatement(foreignKeyReference.columnName(),columnName,ModelUtils.getClassFromAnnotation(foreignKeyReference),foreignKeyReference.foreignColumnName(),false,isModelContainer,true,false,columnFieldType));
      }
      javaWriter.endControlFlow();
    }
    javaWriter.emitSingleLineComment("String_Node_Str");
    javaWriter.emitEmptyLine();
  }
 else {
    String newFieldType=null;
    if (hasTypeConverter) {
      TypeConverterDefinition typeConverterDefinition=manager.getTypeConverterDefinition(modelType);
      if (typeConverterDefinition == null) {
        manager.getMessager().printMessage(Diagnostic.Kind.ERROR,String.format("String_Node_Str",modelType));
      }
 else {
        newFieldType=typeConverterDefinition.getDbElement().asType().toString();
      }
    }
 else {
      newFieldType=columnFieldType;
    }
    String getType=columnFieldType;
    if (element.asType().getKind().isPrimitive()) {
      getType=manager.getTypeUtils().boxedClass((PrimitiveType)element.asType()).asType().toString();
    }
    javaWriter.emitStatement(ModelUtils.getContentValueStatement(columnName,columnName,newFieldType,columnFieldName,isModelContainerDefinition,isModelContainer,false,hasTypeConverter,getType));
  }
}