[9] [XXS] RFR 8137121: (ch) Infinite loop in sun.nio.ch.FileChannelImpl.truncate

Alan Bateman Alan.Bateman at oracle.com
Fri Sep 25 13:46:55 UTC 2015


On 25/09/2015 14:27, Ivan Gerasimov wrote:
> Hello!
>
> A long result of a call to position0 is blindly cast to int, which may 
> accidentally result in (-3) special value.
> Would you please help review the fix?
>
> BUGURL: https://bugs.openjdk.java.net/browse/JDK-8137121
> WEBREV: http://cr.openjdk.java.net/~igerasim/8137121/00/webrev/
The fix looks okay. I guess I would use rp rather than rl.

Can you move the test into FileChannel directory? LoopingTruncate might 
be a a better name for the test.

A minor comment is this might fit better on L51:

try (FileChannel fc = FileChannel.open(path, CREATE, WRITE)) {

-Alan


More information about the nio-dev mailing list