mirror of https://github.com/apache/lucene.git
LUCENE-3176: fix getTempDir to actually return a unique new temp directory (not something based on LTC's seed)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1133383 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
050a2eba3b
commit
8df95b97ef
|
@ -51,12 +51,17 @@ import org.junit.Assert;
|
||||||
|
|
||||||
public class _TestUtil {
|
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. */
|
* does not create the directory. */
|
||||||
public static File getTempDir(String desc) {
|
public static File getTempDir(String desc) {
|
||||||
File f = new File(LuceneTestCase.TEMP_DIR, desc + "." + LuceneTestCase.random.nextLong());
|
try {
|
||||||
|
File f = createTempFile(desc, "tmp", LuceneTestCase.TEMP_DIR);
|
||||||
|
f.delete();
|
||||||
LuceneTestCase.registerTempFile(f);
|
LuceneTestCase.registerTempFile(f);
|
||||||
return f;
|
return f;
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue