[ 
https://issues.apache.org/jira/browse/VFS-243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703082#action_12703082
 ] 

Sebb commented on VFS-243:
--------------------------

The patch throws an error if the skip was short; it might have been better to 
loop until the required number of bytes had been read, or EOF was reached.

But if you are sure that the input will never arrive in chunks, then that is 
not necessary.

> HttpRandomAccesContent.getDataInputStream() ignores result of skip()
> --------------------------------------------------------------------
>
>                 Key: VFS-243
>                 URL: https://issues.apache.org/jira/browse/VFS-243
>             Project: Commons VFS
>          Issue Type: Bug
>            Reporter: Sebb
>            Assignee: Ralph Goers
>             Fix For: 2.0
>
>
> HttpRandomAccesContent.getDataInputStream() ignores result of skip()
> Findbugs says:
> This method ignores the return value of java.io.InputStream.skip() which can 
> skip multiple bytes.  If the return value is not checked, the caller will not 
> be able to correctly handle the case where fewer bytes were skipped than the 
> caller requested.  This is a particularly insidious kind of bug, because in 
> many programs, skips from input streams usually do skip the full amount of 
> data requested, causing the program to fail only sporadically. With Buffered 
> streams, however, skip() will only skip data in the buffer, and will 
> routinely fail to skip the requested number of bytes.

-- 
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