LUCENE-8163: BaseDirectoryTestCase produces random filenames that fail on Windows

This commit is contained in:
Alan Woodward 2018-02-09 09:13:17 +00:00
parent 1527ce57d4
commit 342e38217a
2 changed files with 5 additions and 4 deletions

View File

@ -162,6 +162,9 @@ Bug Fixes
* LUCENE-8124: Fixed HyphenationCompoundWordTokenFilter to handle correctly
hyphenation patterns with indicator >= 7. (Holger Bruch via Adrien Grand)
* LUCENE-8163: BaseDirectoryTestCase could produce random filenames that fail
on Windows (Alan Woodward)
Other
* LUCENE-8111: IndexOrDocValuesQuery Javadoc references outdated method name.

View File

@ -1186,10 +1186,8 @@ public abstract class BaseDirectoryTestCase extends LuceneTestCase {
int count = atLeast(20);
Set<String> names = new HashSet<>();
while(names.size() < count) {
String name = TestUtil.randomSimpleString(random());
if (name.length() == 0) {
continue;
}
// create a random filename (segment file name style), so it cannot hit windows problem with special filenames ("con", "com1",...):
String name = IndexFileNames.segmentFileName(TestUtil.randomSimpleString(random(), 1, 6), TestUtil.randomSimpleString(random()), "test");
if (random().nextInt(5) == 1) {
IndexOutput out = dir.createTempOutput(name, "foo", IOContext.DEFAULT);
names.add(out.getName());