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:
Robert Muir 2011-06-08 13:04:24 +00:00
parent 050a2eba3b
commit 8df95b97ef
1 changed files with 9 additions and 4 deletions

View File

@ -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());
try {
File f = createTempFile(desc, "tmp", LuceneTestCase.TEMP_DIR);
f.delete();
LuceneTestCase.registerTempFile(f);
return f;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**