Fix detection of symlinks in acceptance tests

Delete of temporary files failed if the tmp folder in which the
temporary directory was created is a symlink.

Now, the temporary folder is canonicalized before it is used. This
fixes this issue.

Change-Id: Ic5aa91e5242b5b836131c11b05b8723c50b359d9
This commit is contained in:
Adrian Görler 2014-07-16 18:06:52 +02:00
parent f130079302
commit 4b216ca643

View File

@ -23,7 +23,7 @@ public class TempFileUtil {
private static List<File> allDirsCreated = new ArrayList<>();
public synchronized static File createTempDirectory() throws IOException {
File tmp = File.createTempFile("gerrit_test_", "");
File tmp = File.createTempFile("gerrit_test_", "").getCanonicalFile();
if (!tmp.delete() || !tmp.mkdir()) {
throw new IOException("Cannot create " + tmp.getPath());
}