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

Sijie Guo resolved BOOKKEEPER-958.
----------------------------------
       Resolution: Fixed
    Fix Version/s: 4.5.0

Issue resolved by merging pull request 66
            [https://github.com/apache/bookkeeper/pull/66]

            {noformat}
            commit 026ef10e1e9706ead4f1bc6763ded2e28c91480d
Author:     Charan Reddy Guttapalem <[email protected]>
AuthorDate: Tue Nov 8 23:49:20 2016 -0800
Commit:     Sijie Guo <[email protected]>
CommitDate: Tue Nov 8 23:49:20 2016 -0800

    BOOKKEEPER-958: Fix for ZeroBuffer Bug
    
    Fix for readOnlyBuffer of ZeroBuffer bug
    
    Author: Charan Reddy Guttapalem <[email protected]>
    
    Reviewers: Sijie Guo <[email protected]>
    
    Closes #66 from reddycharan/zerobufferfix

            {noformat}
            

> ZeroBuffer readOnlyBuffer returns ByteBuffer with 0 remaining bytes for 
> length > 64k
> ------------------------------------------------------------------------------------
>
>                 Key: BOOKKEEPER-958
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-958
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Charan Reddy Guttapalem
>            Assignee: Charan Reddy Guttapalem
>            Priority: Trivial
>             Fix For: 4.5.0
>
>
> in ZeroBuffer
> here, if the length is > zeroBytes.length (64K), then it is returning zero 
> ByteBuffer but its position is set to limit and hence its remaining will be 
> 0, which is not expected, but if it is < 64k then its position is set to 0 
> and the remaining will be length.
> Looking at the call hierearchy, it seems there are no callers for this 
> function, but since this is utility class it needs to be corrected.
>     public static ByteBuffer readOnlyBuffer(int length) {
>         ByteBuffer buffer;
>         if (length <= zeroBytes.length) {
>             buffer = ByteBuffer.wrap(zeroBytes, 0, length);
>         }
>         else {
>             buffer = ByteBuffer.allocate(length);
>             put(buffer);
>         }
>         return buffer.asReadOnlyBuffer();
>     }



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

Reply via email to