You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Miroslav Pokorny (Created) (JIRA)" <ji...@apache.org> on 2012/03/20 05:51:46 UTC

[jira] [Created] (VFS-407) 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


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

        

[jira] [Updated] (VFS-407) [RAM] Reading a RAM FileSystem file fails because it never returns EOF -1.

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/VFS-407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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

    Fix Version/s: 2.1
          Summary: [RAM] 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.)
    
> [RAM] 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
>             Fix For: 2.1
>
>         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

        

[jira] [Updated] (VFS-407) reading a RAM FileSystem file fails because it never returns EOF -1.

Posted by "Miroslav Pokorny (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/VFS-407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Miroslav Pokorny updated VFS-407:
---------------------------------

    Attachment: EmptyRamProviderFileBugTests-from-miroslav.pokorny-20120322.patch
                CustomRamProviderTest.java

Trunk seems to be fixed but not included in the latest release for download. I believe i reported this same bug previously but trunk has no tests.

I have submitted the tests in whole and in  patch form. At the least these tests should help stop regressions.
                
> 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

        

[jira] [Issue Comment Edited] (VFS-407) reading a RAM FileSystem file fails because it never returns EOF -1.

Posted by "Miroslav Pokorny (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VFS-407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13235292#comment-13235292 ] 

Miroslav Pokorny edited comment on VFS-407 at 3/22/12 2:14 AM:
---------------------------------------------------------------

Trunk seems to be fixed but not included in the latest release for download. I believe i reported this same bug previously when VFS was 1.x but trunk has no tests.

I have submitted the tests as a raw file *.java and in  patch form. At the least these tests should help stop regressions.
                
      was (Author: mp1):
    Trunk seems to be fixed but not included in the latest release for download. I believe i reported this same bug previously but trunk has no tests.

I have submitted the tests in whole and in  patch form. At the least these tests should help stop regressions.
                  
> 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

        

[jira] [Resolved] (VFS-407) [RAM] Reading a RAM FileSystem file fails because it never returns EOF -1.

Posted by "Gary D. Gregory (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/VFS-407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved VFS-407.
---------------------------------

    Resolution: Fixed

Patch applied, in SVN, thank you!
                
> [RAM] 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
>             Fix For: 2.1
>
>         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

        

[jira] [Commented] (VFS-407) reading a RAM FileSystem file fails because it never returns EOF -1.

Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VFS-407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13234426#comment-13234426 ] 

Gary D. Gregory commented on VFS-407:
-------------------------------------

Can you please provide a patch against trunk and grant the ASF license (a check box when you upload)? 

A unit test that shows the problem if the suggested fix is not in place would be best.

Thank you,
Gary
                
> 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
>   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

        

[jira] [Updated] (VFS-407) Reading a RAM FileSystem file fails because it never returns EOF -1.

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ 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