RFR: JDK-8028628 - java/nio/channels/FileChannel/Size.java failed once in the same binary run

Dan Xu dan.xu at oracle.com
Thu Nov 21 17:02:56 UTC 2013


On 11/21/2013 05:41 AM, Alan Bateman wrote:
> On 21/11/2013 01:09, Dan Xu wrote:
>> Hi All,
>>
>> I have updated my fix based on your suggestions. I have changed to 
>> create testing files in the working directory, moved those static 
>> member variables into local method variables, and used 
>> try-with-resources to read and write the testing files. After the 
>> change, the file delete is no longer important. So I just do the 
>> clean-up with deleteOnExit() for simplicity. If the test fails, it is 
>> better to keep the test file to give more clue. Therefore, I don't 
>> put the file clean-up into finally block. Thanks!
>>
>> Webrev: http://cr.openjdk.java.net/~dxu/8028628/webrev01/
>>
>> -Dan
> Just one thing about testLargeFile, I see that it additionally creates 
> a file-mapping and it's not clear that this is needed (I don't see 
> anything in JDK-4563125 to explain this). I suspect this can be removed.
>
> Otherwise it looks okay to me.
>
> -Alan.
>
>
Hi Alan,

I think the map is used to enlarge the size of the largeFile to testSize 
+ 10. In initTestFile(), it initiates the file with size 10. My 
understanding is that it avoids writing large amount of data into the 
largeFile by using the map. Thanks!

-Dan



More information about the core-libs-dev mailing list