You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Tom White (JIRA)" <ji...@apache.org> on 2014/02/15 21:07:20 UTC

[jira] [Updated] (AVRO-1458) Setting char record field via reflection affects other fields

     [ https://issues.apache.org/jira/browse/AVRO-1458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated AVRO-1458:
----------------------------

    Attachment: AVRO-1458.patch

I tracked this down to UnsafeCharField calling setInt() rather than setChar() on sun.misc.Unsafe. I’m not sure exactly why the other fields are unset (or changed), but it looks like Unsafe lives up to its name and is affecting neighbouring fields when the setter doesn’t match the type.

It looks like the problem was introduced in Avro 1.7.5 in AVRO-1282. I’m marking it as a Blocker since the bug can cause data corruption.

Here’s a test with a fix. Without the fix the test fails. I also added a test for ReflectData#getSchema for a char type, which was missing.


> Setting char record field via reflection affects other fields
> -------------------------------------------------------------
>
>                 Key: AVRO-1458
>                 URL: https://issues.apache.org/jira/browse/AVRO-1458
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.5
>            Reporter: Tom White
>            Assignee: Tom White
>            Priority: Blocker
>             Fix For: 1.7.7
>
>         Attachments: AVRO-1458.patch
>
>
> Calling ReflectData#setField for a char field causes a previously set field (e.g. boolean or byte) to become unset.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)