You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Andrew Gaul (JIRA)" <ji...@apache.org> on 2013/10/22 08:02:48 UTC
[jira] [Created] (THRIFT-2233) Java compiler should defensively
copy its binary inputs
Andrew Gaul created THRIFT-2233:
-----------------------------------
Summary: Java compiler should defensively copy its binary inputs
Key: THRIFT-2233
URL: https://issues.apache.org/jira/browse/THRIFT-2233
Project: Thrift
Issue Type: Improvement
Components: Java - Compiler
Affects Versions: 0.9
Reporter: Andrew Gaul
Fix For: 0.9.2
Currently if someone calls the bufferForField accessor then calls ByteBuffer.get, this mutates the struct's ByteBuffer field. Subsequent calls to bufferForField return the mutated field and thus calls to ByteBuffer.get return unexpected results.
{noformat}
MyStruct myStruct = ...;
byte[] array = new byte[myStruct.bufferForValue().capacity()];
someStruct.bufferForValue().get(array);
someStruct.bufferForValue().get(array); // previously, NPE
{noformat}
--
This message was sent by Atlassian JIRA
(v6.1#6144)