JDK 10 RFR of JDK-8189775: java/nio/channels/FileChannel/directio/ReadDirect.java failed with NumberFormatException

Roger Riggs Roger.Riggs at Oracle.com
Wed Oct 25 21:22:48 UTC 2017


Looks fine,

Thanks, Roger


On 10/25/2017 5:09 PM, Brian Burkhalter wrote:
> https://bugs.openjdk.java.net/browse/JDK-8189775
> http://cr.openjdk.java.net/~bpb/8189775/webrev.00/
>
> The test reads from a FileChannel opened on a file of size 100*charsPerGroup bytes where charsPerGroup is the block size. The scattering read test reads two buffers, that is 2*charsPerGroup bytes. The offset of the scattering read is created using a random number generator in effect as
>
> offset = random.nextInt(100)*charsPerGroup;
>
> In this particular case, the random number generated for the seed used is 99 so nothing will be read into the second of the two buffers which will instead remain filled with (byte)’a’ resulting in the observed NumberFormatException. Clamping the random number to [0,99) solves the problem.
>
> Thanks,
>
> Brian



More information about the nio-dev mailing list