commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary D. Gregory (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (VFS-407) Reading a RAM FileSystem file fails because it never returns EOF -1.
Date Thu, 22 Mar 2012 13:44:25 GMT

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

Gary D. Gregory updated VFS-407:
--------------------------------

    Summary: Reading a RAM FileSystem file fails because it never returns EOF -1.  (was: reading
a RAM FileSystem file fails because it never returns EOF -1.)
    
> Reading a RAM FileSystem file fails because it never returns EOF -1.
> --------------------------------------------------------------------
>
>                 Key: VFS-407
>                 URL: https://issues.apache.org/jira/browse/VFS-407
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Miroslav Pokorny
>         Attachments: CustomRamProviderTest.java, EmptyRamProviderFileBugTests-from-miroslav.pokorny-20120322.patch
>
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> RamFileRandomAccessContent
> ORIGINAL
> @Override
>             public int read(byte[] b, int off, int len) throws IOException
>             {
>                 int retLen = Math.min(len, getLeftBytes());
>                 RamFileRandomAccessContent.this.readFully(b, off, retLen);
>                 return retLen;
>             }
> // getLeftBytes() returns 0 when empty. retLen is 0 when empty and never -1.
> FIXED
>             // HACK Patched to return -1 when empty previously it returned 0
>             @Override
>             public int read(final byte[] b, final int off, final int len) throws IOException
{
>                 int retLen = InputStreams.END;
>                 final int left = RamFileRandomAccessContent.this.getLeftBytes();
>                 if (left > 0) {
>                     retLen = Math.min(len, left);
>                     RamFileRandomAccessContent.this.readFully(b, off, retLen);
>                 }
>                 return retLen;
>             }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message