Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-407

[RAM] Reading a RAM FileSystem file fails because it never returns EOF -1.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 2.1
    • None

    Description

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            mp1 Miroslav Pokorny
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 5m
                5m
                Remaining:
                Remaining Estimate - 5m
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified