LUCENE-3137: Benchmark's ExtractReuters created its temp dir wrongly if provided out-dir param ended by slash

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1127436 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doron Cohen 2011-05-25 08:50:16 +00:00
parent fdc3f55f8e
commit f24c33f4fe
2 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,9 @@ Lucene Benchmark Contrib Change Log
The 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/2011
Updated ReadTask to the new method for obtaining a top-level deleted docs
bitset. Also checking the bitset for null, when there are no deleted docs.

View File

@ -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>");
}
}