[jira] [Commented] (AVRO-1799) java: GenericData.toString() mutates underlying ByteBuffer backed data
[ https://issues.apache.org/jira/browse/AVRO-1799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15821653#comment-15821653 ] Ryan Skraba commented on AVRO-1799: --- Just for reference, it looks like this has been fixed in 1.8.1 as well. Excellent! > java: GenericData.toString() mutates underlying ByteBuffer backed data > -- > > Key: AVRO-1799 > URL: https://issues.apache.org/jira/browse/AVRO-1799 > Project: Avro > Issue Type: Bug > Components: java >Affects Versions: 1.8.0 >Reporter: Greg McNutt >Assignee: Ryan Blue >Priority: Critical > Fix For: 1.9.0 > > > Around line 550, the writeEscapedString() method, used to serialize a byte > array, will alter the underlying ByteBuffer's pointer. Meaning subsequent > uses of a toString()'d avro object will yield different results. > Need to not use a generic decode on a ByteBuffer; either clone the element > (expensive), or iterate over the elements with an external index. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (AVRO-1799) java: GenericData.toString() mutates underlying ByteBuffer backed data
[ https://issues.apache.org/jira/browse/AVRO-1799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15172396#comment-15172396 ] ASF GitHub Bot commented on AVRO-1799: -- Github user rdblue closed the pull request at: https://github.com/apache/avro/pull/73 > java: GenericData.toString() mutates underlying ByteBuffer backed data > -- > > Key: AVRO-1799 > URL: https://issues.apache.org/jira/browse/AVRO-1799 > Project: Avro > Issue Type: Bug > Components: java >Affects Versions: 1.8.0 >Reporter: Greg McNutt >Priority: Critical > > Around line 550, the writeEscapedString() method, used to serialize a byte > array, will alter the underlying ByteBuffer's pointer. Meaning subsequent > uses of a toString()'d avro object will yield different results. > Need to not use a generic decode on a ByteBuffer; either clone the element > (expensive), or iterate over the elements with an external index. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (AVRO-1799) java: GenericData.toString() mutates underlying ByteBuffer backed data
[ https://issues.apache.org/jira/browse/AVRO-1799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15172361#comment-15172361 ] ASF subversion and git services commented on AVRO-1799: --- Commit 62ad11dcf765d6735ef652f4252d19e4ded7afae in avro's branch refs/heads/master from [~rdblue] [ https://git-wip-us.apache.org/repos/asf?p=avro.git;h=62ad11d ] AVRO-1799: Fix GenericRecord#toString ByteBuffer bug. Reading the ByteBuffer to return a string representaton modified the buffer's position. The solution is to duplicate the buffer before reading its content. > java: GenericData.toString() mutates underlying ByteBuffer backed data > -- > > Key: AVRO-1799 > URL: https://issues.apache.org/jira/browse/AVRO-1799 > Project: Avro > Issue Type: Bug > Components: java >Affects Versions: 1.8.0 >Reporter: Greg McNutt >Priority: Critical > > Around line 550, the writeEscapedString() method, used to serialize a byte > array, will alter the underlying ByteBuffer's pointer. Meaning subsequent > uses of a toString()'d avro object will yield different results. > Need to not use a generic decode on a ByteBuffer; either clone the element > (expensive), or iterate over the elements with an external index. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (AVRO-1799) java: GenericData.toString() mutates underlying ByteBuffer backed data
[ https://issues.apache.org/jira/browse/AVRO-1799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15167388#comment-15167388 ] Ryan Blue commented on AVRO-1799: - Thanks for reviewing Greg! I've updated the test as you suggested and I'll merge this later today unless someone objects. > java: GenericData.toString() mutates underlying ByteBuffer backed data > -- > > Key: AVRO-1799 > URL: https://issues.apache.org/jira/browse/AVRO-1799 > Project: Avro > Issue Type: Bug > Components: java >Affects Versions: 1.8.0 >Reporter: Greg McNutt >Priority: Critical > > Around line 550, the writeEscapedString() method, used to serialize a byte > array, will alter the underlying ByteBuffer's pointer. Meaning subsequent > uses of a toString()'d avro object will yield different results. > Need to not use a generic decode on a ByteBuffer; either clone the element > (expensive), or iterate over the elements with an external index. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (AVRO-1799) java: GenericData.toString() mutates underlying ByteBuffer backed data
[ https://issues.apache.org/jira/browse/AVRO-1799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15167331#comment-15167331 ] Greg McNutt commented on AVRO-1799: --- should be ok -- works for me -- there is one unit test in there that could be extended to compare the results before and after a toString() -- at least as a guard for future changes.. > java: GenericData.toString() mutates underlying ByteBuffer backed data > -- > > Key: AVRO-1799 > URL: https://issues.apache.org/jira/browse/AVRO-1799 > Project: Avro > Issue Type: Bug > Components: java >Affects Versions: 1.8.0 >Reporter: Greg McNutt >Priority: Critical > > Around line 550, the writeEscapedString() method, used to serialize a byte > array, will alter the underlying ByteBuffer's pointer. Meaning subsequent > uses of a toString()'d avro object will yield different results. > Need to not use a generic decode on a ByteBuffer; either clone the element > (expensive), or iterate over the elements with an external index. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (AVRO-1799) java: GenericData.toString() mutates underlying ByteBuffer backed data
[ https://issues.apache.org/jira/browse/AVRO-1799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15156389#comment-15156389 ] ASF GitHub Bot commented on AVRO-1799: -- GitHub user rdblue opened a pull request: https://github.com/apache/avro/pull/73 AVRO-1799: Fix GenericRecord#toString ByteBuffer bug. Reading the ByteBuffer to return a string representaton modified the buffer's position. The solution is to duplicate the buffer before reading its content. You can merge this pull request into a Git repository by running: $ git pull https://github.com/rdblue/avro AVRO-1799-tostring-bytebuffer-bug Alternatively you can review and apply these changes as the patch at: https://github.com/apache/avro/pull/73.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #73 commit 5883a1845305f7f2cab7847488e79839f32bdbea Author: Ryan BlueDate: 2016-02-22T02:16:07Z AVRO-1799: Fix GenericRecord#toString ByteBuffer bug. Reading the ByteBuffer to return a string representaton modified the buffer's position. The solution is to duplicate the buffer before reading its content. > java: GenericData.toString() mutates underlying ByteBuffer backed data > -- > > Key: AVRO-1799 > URL: https://issues.apache.org/jira/browse/AVRO-1799 > Project: Avro > Issue Type: Bug > Components: java >Affects Versions: 1.8.0 >Reporter: Greg McNutt >Priority: Critical > > Around line 550, the writeEscapedString() method, used to serialize a byte > array, will alter the underlying ByteBuffer's pointer. Meaning subsequent > uses of a toString()'d avro object will yield different results. > Need to not use a generic decode on a ByteBuffer; either clone the element > (expensive), or iterate over the elements with an external index. -- This message was sent by Atlassian JIRA (v6.3.4#6332)