You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "ramkrishna.s.vasudevan (JIRA)" <ji...@apache.org> on 2016/10/24 10:13:58 UTC

[jira] [Updated] (HBASE-16880) Correct the javadoc/behaviour of the APIs in ByteBufferUtils

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

ramkrishna.s.vasudevan updated HBASE-16880:
-------------------------------------------
    Attachment: HBASE-16880.patch

Patch that changes the javadoc and the behaviour of the BBUtils#copyFromBuffertoBuffer(ByteBuffer, ByteBuffer).
I verified all other copyFromXXXtoXXX APIs and they all seems to have the correct doc and the behaviour.

> Correct the javadoc/behaviour of the APIs in ByteBufferUtils
> ------------------------------------------------------------
>
>                 Key: HBASE-16880
>                 URL: https://issues.apache.org/jira/browse/HBASE-16880
>             Project: HBase
>          Issue Type: Bug
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>         Attachments: HBASE-16880.patch
>
>
> There are some issues either with the javadoc or the actual behaviour of some APIs in BBUtils.
> For eg,
> BBUtil#copyFromBufferToBuffer() says
> {code}
>   /**
>    * Copy one buffer's whole data to another. Write starts at the current position of 'out' buffer.
>    * Note : This will advance the position marker of {@code out} but not change the position maker
>    * for {@code in}. The position and limit of the {@code in} buffer to be set properly by caller.
>    * @param in source buffer
>    * @param out destination buffer
> {code}
> But this is true in case of UNSAFE.
> {code}
>     if (UNSAFE_AVAIL) {
>       int length = in.remaining();
>       UnsafeAccess.copy(in, in.position(), out, out.position(), length);
>       out.position(out.position() + length);
>     } else {
>       out.put(in);
>     }
> {code}
> But in other case where we move the else - the 'in' is also advanced. So we need to either correct the behaviour or change the doc and see all the used places. This JIRA can be used to correct all the APIs in this util class.



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