You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2016/06/11 09:32:20 UTC
lucene-solr:branch_6x: LUCENE-7333: Fix test bug where
randomSimpleString() generated a filename that is a reserved device name on
Windows
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 7520d79e0 -> b9fb98d59
LUCENE-7333: Fix test bug where randomSimpleString() generated a filename that is a reserved device name on Windows
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b9fb98d5
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b9fb98d5
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b9fb98d5
Branch: refs/heads/branch_6x
Commit: b9fb98d59ac8281edd59ea8ad937f7e33b2b98b6
Parents: 7520d79
Author: Uwe Schindler <us...@apache.org>
Authored: Sat Jun 11 11:31:12 2016 +0200
Committer: Uwe Schindler <us...@apache.org>
Committed: Sat Jun 11 11:32:08 2016 +0200
----------------------------------------------------------------------
lucene/CHANGES.txt | 3 +++
.../java/org/apache/lucene/store/BaseDirectoryTestCase.java | 7 +++----
2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b9fb98d5/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index baaef53..b20305b 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -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,
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b9fb98d5/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
index 44c03ea..5ca8a86 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryTestCase.java
@@ -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
}