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

Brian Burkhalter brian.burkhalter at oracle.com
Wed Oct 25 21:09:21 UTC 2017


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.



More information about the nio-dev mailing list