[ 
https://issues.apache.org/jira/browse/ACCUMULO-4113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15109060#comment-15109060
 ] 

Keith Turner commented on ACCUMULO-4113:
----------------------------------------

Another type of bug I have discovered is code calling 
{{ByteBuffer.get(byte[])}}.  The {{get()}} method advances the byte buffers 
position, which is not the intention of the code calling {{get()}}.  

> Fix incorrect usage of ByteBuffer
> ---------------------------------
>
>                 Key: ACCUMULO-4113
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-4113
>             Project: Accumulo
>          Issue Type: Bug
>    Affects Versions: 1.6.4, 1.7.0
>            Reporter: Keith Turner
>            Assignee: Keith Turner
>            Priority: Critical
>             Fix For: 1.6.5, 1.7.1, 1.8.0
>
>
> While working on ACCUMULO-4098 I found one place where ByteBuffer was being 
> used incorrectly.   Looking around the code, I have found other places that 
> are using ByteBuffer incorrectly.  Some of the problems I found are as 
> follows :
>  * Calling {{ByteBuffer.array()}} without calling {{ByteBuffer.hasArray()}}.
>  * Using {{ByteBuffer.position()}} or {{ByteBuffer.limit()}} without adding 
> {{ByteBuffer.arrayOffset()}} when dealing with an array returned by 
> {{ByteBuffer.array()}}.
>  * Using {{ByteBuffer.arrayOffset()}} without adding 
> {{ByteBuffer.position()}} when dealing with an array returned by 
> {{ByteBuffer.array()}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to