Apache Lucene open-source search software
LUCENE-3137: Benchmark's ExtractReuters created its temp dir wrongly if provided out-dir param ended by slash
Doron Cohenf24c33f4fe03
diff --git a/modules/benchmark/CHANGES.txt b/modules/benchmark/CHANGES.txtindex cf27bd978b2..2205f6e4a07 100644--- a/modules/benchmark/CHANGES.txt+++ b/modules/benchmark/CHANGES.txt@@ -2,6 +2,9 @@ Lucene Benchmark Contrib Change LogThe Benchmark contrib package contains code for benchmarking Lucene in a variety of ways.+05/25/2011+ LUCENE-3137: ExtractReuters supports out-dir param suffixed by a slash. (Doron Cohen)+03/31/2011Updated ReadTask to the new method for obtaining a top-level deleted docsbitset. Also checking the bitset for null, when there are no deleted docs.diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.javaindex 395d640fc72..82fa2a01b25 100644--- a/modules/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java+++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java@@ -122,17 +122,19 @@ public class ExtractReuters {public static void main(String[] args) {if (args.length != 2) {- printUsage();+ usage("Wrong number of arguments ("+args.length+")");+ return;}File reutersDir = new File(args[0]);if (!reutersDir.exists()) {- printUsage();+ usage("Cannot find Path to Reuters SGM files ("+reutersDir+")");return;}// First, extract to a tmp directory and only if everything succeeds, rename// to output directory.- File outputDir = new File(args[1] + "-tmp");+ File outputDir = new File(args[1]);+ outputDir = new File(outputDir.getAbsolutePath() + "-tmp");outputDir.mkdirs();ExtractReuters extractor = new ExtractReuters(reutersDir, outputDir);extractor.extract();@@ -140,8 +142,8 @@ public class ExtractReuters {outputDir.renameTo(new File(args[1]));}- private static void printUsage() {- System.err.println("Usage: java -cp <...> org.apache.lucene.benchmark.utils.ExtractReuters <Path to Reuters SGM files> <Output Path>");+ private static void usage(String msg) {+ System.err.println("Usage: "+msg+" :: java -cp <...> org.apache.lucene.benchmark.utils.ExtractReuters <Path to Reuters SGM files> <Output Path>");}}