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[]
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.