You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "dhruba borthakur (JIRA)" <ji...@apache.org> on 2007/06/01 00:56:15 UTC

[jira] Commented: (HADOOP-1311) Bug in BytesWritable.set(byte[] newData, int offset, int length)

    [ https://issues.apache.org/jira/browse/HADOOP-1311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500515 ] 

dhruba borthakur commented on HADOOP-1311:
------------------------------------------

But just before the call to arraycopy, we invoke setSize(length). This sets size = length. Thus, size and length are the same when the arraycopy is invoked.

> Bug in BytesWritable.set(byte[] newData, int offset, int length) 
> -----------------------------------------------------------------
>
>                 Key: HADOOP-1311
>                 URL: https://issues.apache.org/jira/browse/HADOOP-1311
>             Project: Hadoop
>          Issue Type: Bug
>          Components: io
>         Environment: N/A
>            Reporter: Srikanth Kakani
>         Attachments: bytesWritable.patch
>
>
> Current implementation:
>   public void set(byte[] newData, int offset, int length) {
>     setSize(0);
>     setSize(length);
>     System.arraycopy(newData, 0, bytes, 0, size);
>   }
> Correct implementation:
>   public void set(byte[] newData, int offset, int length) {
>     setSize(0);
>     setSize(length);
>     System.arraycopy(newData, offset, bytes, 0, size);
>   }
> please fix.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.