Uploaded image for project: 'Flume'
  1. Flume
  2. FLUME-2705

changes to isEndOfInput calculation in ResettableFileInputStream

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      Currently isEndOfInput in ResettableFileInputStream will be set to true, only if end of stream has already been reached.
      But this should not be the case, as the decoder's description of isEndOfStream mentions that, "The endOfInput parameter advises this method as to whether the invoker can provide further input beyond that contained in the given input buffer"
      So instead of checking for if (position >= fileSize)
      this should be like if(position + buf.remaining() >= fileSize)

      An example to reproduce this error :
      This is a valid UTF-8 character
      new byte[]

      { (byte)0xf0, (byte)0x9f, (byte)0x98, (byte)0x93 }

      that can be passed to the ResettableFileInputStream
      removing the last byte in this sequence and just passing (byte)0xf0, (byte)0x9f, (byte)0x98, should throw a MalformedInputException when the DecodeErrorPolicy.FAIL is specified,

      but in the current behavior, this doesnot happen.

      Attachments

        Activity

          People

            jrufus Johny Rufus
            jrufus Johny Rufus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: