Apache Lucene open-source search software
LUCENE-3176: fix getTempDir to actually return a unique new temp directory (not something based on LTC's seed)
Robert Muir8df95b97efb8
diff --git a/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java b/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.javaindex 020f08b9f7d..4d53cd3a168 100644--- a/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java+++ b/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java@@ -51,12 +51,17 @@ import org.junit.Assert;public class _TestUtil {- /** Returns temp dir, containing String arg in its name;+ /** Returns temp dir, based on String arg in its name;* does not create the directory. */public static File getTempDir(String desc) {- File f = new File(LuceneTestCase.TEMP_DIR, desc + "." + LuceneTestCase.random.nextLong());- LuceneTestCase.registerTempFile(f);- return f;+ try {+ File f = createTempFile(desc, "tmp", LuceneTestCase.TEMP_DIR);+ f.delete();+ LuceneTestCase.registerTempFile(f);+ return f;+ } catch (IOException e) {+ throw new RuntimeException(e);+ }}/**