JDK 10 RFR of test-only bug 8183320, et. al.: Better cleanup of temp files created by [N]IO tests

Brian Burkhalter brian.burkhalter at oracle.com
Wed Jul 19 00:58:27 UTC 2017


On Jul 18, 2017, at 3:40 AM, Chris Hegarty <chris.hegarty at oracle.com> wrote:

>> On 17 Jul 2017, at 20:49, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>> 
>> Please review at your convenience this patch for [1, 2, 3, 4]:
>> 
>> http://cr.openjdk.java.net/~bpb/8183320/webrev.00/
> 
> These mainly look fine.
> 
> On test/java/io/File/createTempFile/SpecialTempFile.java, your changes
> seem to change what is being tested. Is this intentional?

Actually looking back over it, my changes in this test were a no-op: they merely changed how an unused variable was initialized. Hopefully the updated version [1] is correct.

On Jul 18, 2017, at 4:09 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

> On 17/07/2017 20:49, Brian Burkhalter wrote:
>> Please review at your convenience this patch for [1, 2, 3, 4]:
>> 
>> http://cr.openjdk.java.net/~bpb/8183320/webrev.00/
>> 
>> Note that without the existence check at line 60, the SetDefaultProvider test fails with a FileAlreadyExistsException.
>> 
> In SetDefaultProvider then it's important that the tests get a unique temp directory, otherwise will get interference between the testExplodedWithXXXX tests. This should do it:
> 
>  Path here = Paths.get("");
>  Patch patchdir = Files.createTempDirectory(here, "patch");


I changed it to something slightly different [1] from the above suggestion:
    private static Path createTempDirectory(String prefix) throws IOException {
        Path testDir = Paths.get(System.getProperty("test.dir", "."));
        return Files.createTempDirectory(testDir, prefix);
    }
In version .01 of the patch, only SpecialTempFile and SetDefaultProvider are changed with respect to version .00.
Thanks,

Brian

[1] http://cr.openjdk.java.net/~bpb/8183320/webrev.01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20170718/32f556f8/attachment.html>


More information about the nio-dev mailing list