[ https://issues.apache.org/jira/browse/THRIFT-2233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jake Farrell updated THRIFT-2233: --------------------------------- Assignee: Andrew Gaul > 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 > Assignee: Andrew Gaul > Fix For: 0.9.2 > > Attachments: THRIFT-2233.patch > > > 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.5#6160)