RFR: JDK-8028628 - java/nio/channels/FileChannel/Size.java failed once in the same binary run
Alan Bateman
Alan.Bateman at oracle.com
Wed Nov 20 12:08:07 UTC 2013
On 19/11/2013 23:57, Dan Xu wrote:
> Hi All,
>
> Please review the simple fix towards Size.java testcase. It failed
> once on windows platform in the recent same binary run, which is
> mostly due to some interferences and the special delete handling on
> windows.
>
> In the fix, I remove the delete operation in initTestFile() method
> because FileOutputStream will truncate the file content and it is not
> necessary to delete it first. Thanks!
>
> Bug:https://bugs.openjdk.java.net/browse/JDK-8028628
> Webrev: http://cr.openjdk.java.net/~dxu/8028628/webrev/
> <http://cr.openjdk.java.net/%7Edxu/8028628/webrev/>
This does look like a case where the test is needlessly deleting and
re-creating the file (although still annoying to have interference from
virus checkers or other background services). As you point out,
FileOutputStream will truncate an existing file so it's not needed. So I
think your changes to remove the exist/delete from the init method is good.
If you have the cycles then there are probably a few clean-ups that
could be done on this test. I don't think blah needs to be static, it
could use try-with-resources and delete blah in the finally block. Also
test2 looks historical, it may be that this can be enabled on Linux and
Windows now (the bug/comments seem to date from JDK 1.4).
-Alan
More information about the core-libs-dev
mailing list