You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2016/06/16 12:08:43 UTC
[13/50] [abbrv] lucene-solr:apiv2: LUCENE-7333: Fix test bug where
randomSimpleString() generated a filename that is a reserved device name on
Windows
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/cc7cede7
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/cc7cede7
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/cc7cede7
Branch: refs/heads/apiv2
Commit: cc7cede7a58b4e1d0eaeb182998de69cad90c15a
Parents: c0f047a
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:31:12 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/cc7cede7/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index fb5d93a..501f2ee 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -147,6 +147,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/cc7cede7/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
}