[ 
https://issues.apache.org/jira/browse/HADOOP-6177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740395#action_12740395
 ] 

Hong Tang commented on HADOOP-6177:
-----------------------------------

The root cause is because readChecksumChunk returns -1 when the fs input stream 
reaches the end of the file. And in fill(), this leads to count == -1 
(FSInputChecker.java:176). The fix is rather simple, adding the following line 
at the end of fill():
{noformat}
     count = readChecksumChunk(buf, 0, buf.length);
+    if (count < 0) count = 0; 
{noformat}

> FSInputChecker.getPos() would return position greater than the file size
> ------------------------------------------------------------------------
>
>                 Key: HADOOP-6177
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6177
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Hong Tang
>            Assignee: Hong Tang
>         Attachments: hadoop-6177-testcase.patch
>
>
> When using a small buffer (< 512 bytes) to read through the whole file, the 
> final file position is 1+ the file size.

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

Reply via email to