RFR: 8023113: tools/jar/ChangeDir.java fails if /tmp/a exists

Xueming Shen xueming.shen at oracle.com
Wed Sep 18 16:42:13 UTC 2013

On 09/18/2013 03:31 AM, Alan Bateman wrote:
> On 17/09/2013 22:55, Xueming Shen wrote:
>> Hi,
>> Please help the small update to the test case tools/jar/ChangeDir.java,
>> which might fail if the "dedicated" test directory /tmp/a exists and the
>> user does not have privilege to delete/clean it up.
>> The proposed change here is to use a random file name (from File.getTempFile())
>> for the top test directory (instead of the fixed /tmp/a), and really clean it up
>> after testing (the old test leaves /tmp/a and those temp files undeleted).
>> http://cr.openjdk.java.net/~sherman/8023113/webrev
> I've run into this a few times so thanks for fixing it.
> What you have is okay although some of the setup and cleanup could be reduced, for example doTest could setup the test tree with:
> Path topDir = Files.createTempDirectory("delete");
> Path testDir = Files.createDirectories(topDir.resolve("a").resolve("b"));
> It's not important for this fix of course, just an observation when looking at an old test.
thought about using the nio,  but then decided to keep the test as the classic "old" io,
otherwise I would end up with rewriting the test:-)


> -Alan.

More information about the core-libs-dev mailing list