Johny Rufus created FLUME-2705:
----------------------------------

             Summary: changes to isEndOfInput calculation in 
ResettableFileInputStream
                 Key: FLUME-2705
                 URL: https://issues.apache.org/jira/browse/FLUME-2705
             Project: Flume
          Issue Type: Bug
            Reporter: Johny Rufus
            Assignee: Johny Rufus


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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to