Skip to content

Apache Lucene open-source search software

LUCENE-3023: merged with trunk

Simon Willnauer990a5d6f3a82
diff --cc lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java
index 84a9d21bd00,be1a4500f1e..f02d6f9ec3e
--- a/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java
+++ b/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java
@@@ -77,22 -79,23 +79,23 @@@ public class _TestUtil
}
}
- /**
- * Convenience method: Unzip zipName + ".zip" under destDir, removing destDir first
+ /**
+ * Convenience method: Unzip zipName + ".zip" under destDir, removing destDir first
*/
public static void unzip(File zipName, File destDir) throws IOException {
-
+
ZipFile zipFile = new ZipFile(zipName);
-
+
Enumeration<? extends ZipEntry> entries = zipFile.entries();
-
+
rmDir(destDir);
-
+
destDir.mkdir();
-
+ LuceneTestCase.tempDirs.add(destDir.getAbsolutePath());
+
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
-
+
InputStream in = zipFile.getInputStream(entry);
File targetFile = new File(destDir, entry.getName());
if (entry.isDirectory()) {
diff --cc lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
index 970c2590f41,261a0bebd41..a7254b9b5c9
--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
@@@ -2754,9 -2753,9 +2754,9 @@@ public class TestIndexWriter extends Lu
public void testEmptyFSDirWithNoLock() throws Exception {
// Tests that if FSDir is opened w/ a NoLockFactory (or SingleInstanceLF),
- // then IndexWriter ctor succeeds. Previously (LUCENE-2386) it failed
+ // then IndexWriter ctor succeeds. Previously (LUCENE-2386) it failed
// when listAll() was called in IndexFileDeleter.
- Directory dir = newFSDirectory(new File(TEMP_DIR, "emptyFSDirNoLock"), NoLockFactory.getNoLockFactory());
+ Directory dir = newFSDirectory(_TestUtil.getTempDir("emptyFSDirNoLock"), NoLockFactory.getNoLockFactory());
new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random))).close();
dir.close();
}