From f24c33f4fe0355bc386ac1f6131245696e42337a Mon Sep 17 00:00:00 2001 From: Doron Cohen Date: Wed, 25 May 2011 08:50:16 +0000 Subject: [PATCH] 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 --- modules/benchmark/CHANGES.txt | 3 +++ .../lucene/benchmark/utils/ExtractReuters.java | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/benchmark/CHANGES.txt b/modules/benchmark/CHANGES.txt index cf27bd978b2..2205f6e4a07 100644 --- a/modules/benchmark/CHANGES.txt +++ b/modules/benchmark/CHANGES.txt @@ -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. 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.java index 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 "); + private static void usage(String msg) { + System.err.println("Usage: "+msg+" :: java -cp <...> org.apache.lucene.benchmark.utils.ExtractReuters "); } }