[jira] [Created] (VFS-355) RamFileProvider: ReadingRamFileRandomAccessContent InputStream of file does not return -1 when empty...

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (VFS-355) RamFileProvider: ReadingRamFileRandomAccessContent InputStream of file does not return -1 when empty...

Alex D Herbert (Jira)
RamFileProvider: ReadingRamFileRandomAccessContent InputStream of file does not return -1 when empty...
-------------------------------------------------------------------------------------------------------

                 Key: VFS-355
                 URL: https://issues.apache.org/jira/browse/VFS-355
             Project: Commons VFS
          Issue Type: Bug
    Affects Versions: 1.0
         Environment: N/A
            Reporter: Miroslav Pokorny


RamFileRandomAccessContent

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

Notice retLen should return 1 if getLeftBytes() returns 0 but it doesnt. When empty it simply returns 0 which means if one reads until -1 it never happens...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (VFS-355) RamFileProvider: ReadingRamFileRandomAccessContent InputStream of file does not return -1 when empty...

Alex D Herbert (Jira)

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

Miroslav Pokorny commented on VFS-355:
--------------------------------------

replacing RamFileRandomAccessContent.InputStream.read(byte[],int,int) with the code below *WORKS*...

@Override
            public int read(byte b[], int off, int len) throws IOException {
                int count = -1;
                final int left = getLeftBytes();
                if (left > 0) {
                    count = Math.min(len, left);
                    RamFileRandomAccessContent.this.readFully(b, off, count);
                    ;
                }
                return count;
            }

> RamFileProvider: ReadingRamFileRandomAccessContent InputStream of file does not return -1 when empty...
> -------------------------------------------------------------------------------------------------------
>
>                 Key: VFS-355
>                 URL: https://issues.apache.org/jira/browse/VFS-355
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: N/A
>            Reporter: Miroslav Pokorny
>
> RamFileRandomAccessContent
> 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;
> }
> Notice retLen should return 1 if getLeftBytes() returns 0 but it doesnt. When empty it simply returns 0 which means if one reads until -1 it never happens...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (VFS-355) RamFileProvider: ReadingRamFileRandomAccessContent InputStream of file does not return -1 when empty...

Alex D Herbert (Jira)
In reply to this post by Alex D Herbert (Jira)

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

Ralph Goers resolved VFS-355.
-----------------------------

       Resolution: Fixed
    Fix Version/s: 2.1

Path applied. Please verify and close.

> RamFileProvider: ReadingRamFileRandomAccessContent InputStream of file does not return -1 when empty...
> -------------------------------------------------------------------------------------------------------
>
>                 Key: VFS-355
>                 URL: https://issues.apache.org/jira/browse/VFS-355
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: N/A
>            Reporter: Miroslav Pokorny
>             Fix For: 2.1
>
>
> RamFileRandomAccessContent
> 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;
> }
> Notice retLen should return 1 if getLeftBytes() returns 0 but it doesnt. When empty it simply returns 0 which means if one reads until -1 it never happens...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Closed] (VFS-355) RamFileProvider: ReadingRamFileRandomAccessContent InputStream of file does not return -1 when empty...

Alex D Herbert (Jira)
In reply to this post by Alex D Herbert (Jira)

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

Miroslav Pokorny closed VFS-355.
--------------------------------


;)
               

> RamFileProvider: ReadingRamFileRandomAccessContent InputStream of file does not return -1 when empty...
> -------------------------------------------------------------------------------------------------------
>
>                 Key: VFS-355
>                 URL: https://issues.apache.org/jira/browse/VFS-355
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: N/A
>            Reporter: Miroslav Pokorny
>             Fix For: 2.1
>
>
> RamFileRandomAccessContent
> 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;
> }
> Notice retLen should return 1 if getLeftBytes() returns 0 but it doesnt. When empty it simply returns 0 which means if one reads until -1 it never happens...

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