mirror of https://github.com/apache/lucene.git
LUCENE-7333: Fix test bug where randomSimpleString() generated a filename that is a reserved device name on Windows
This commit is contained in:
parent
7520d79e04
commit
b9fb98d59a
|
@ -132,6 +132,9 @@ Bug Fixes
|
|||
dateline and indexed non-point shapes are much bigger than the heatmap region.
|
||||
(David Smiley)
|
||||
|
||||
* LUCENE-7333: Fix test bug where randomSimpleString() generated a filename
|
||||
that is a reserved device name on Windows. (Uwe Schindler, Mike McCandless)
|
||||
|
||||
Other
|
||||
|
||||
* LUCENE-7295: TermAutomatonQuery.hashCode calculates Automaton.toDot().hash,
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.Set;
|
|||
import java.util.zip.CRC32;
|
||||
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.index.IndexFileNames;
|
||||
import org.apache.lucene.index.IndexNotFoundException;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
@ -1208,10 +1209,8 @@ public abstract class BaseDirectoryTestCase extends LuceneTestCase {
|
|||
// Keep trying until virus checker refuses to delete:
|
||||
final String fileName;
|
||||
while (true) {
|
||||
String candidate = TestUtil.randomSimpleString(random());
|
||||
if (candidate.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
// create a random filename (segment file name style), so it cannot hit windows problem with special filenames ("con", "com1",...):
|
||||
String candidate = IndexFileNames.segmentFileName(TestUtil.randomSimpleString(random(), 1, 6), TestUtil.randomSimpleString(random()), "test");
|
||||
try (IndexOutput out = dir.createOutput(candidate, IOContext.DEFAULT)) {
|
||||
out.getFilePointer(); // just fake access to prevent compiler warning
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue