On 2019-12-19, Peter Lee wrote: > Hi all.
> A recent issue COMPRESS-499( > https://issues.apache.org/jira/projects/COMPRESS/issues/COMPRESS-499) > discussed about a potential problem in SeekableInMemoryByteChannel. > Based on the java docs( > https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/channels/SeekableByteChannel.html#truncate(long > )), I believe there are some problems in the SeekableInMemoryByteChannel . Agreed. > The method repositionIfNecessary() may change the position of the channel, > which may be a bug basing on the docs, and it's called in read and > truncate. I'm not an expert on SeekableByteChannel, and I'm not sure if > SeekableInMemoryByteChannel is doing this intentionally or not. I agree with your suggestion to add tests that verify we adhere to the SeekableByteChannel contract for (more or less) all methods. I've looked through the commit history and - as the one who introduced repositionIfNecessary - believe it is just wrong. Even if existing tests fail when it gets adjusted this may just indicate I haven't read up on the interface's contract properly when I wrote the tests. :-) Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
