You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by do...@apache.org on 2011/05/25 10:50:16 UTC

svn commit: r1127436 - in /lucene/dev/trunk/modules/benchmark: CHANGES.txt src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java

Author: doronc
Date: Wed May 25 08:50:16 2011
New Revision: 1127436

URL: http://svn.apache.org/viewvc?rev=1127436&view=rev
Log:
LUCENE-3137: Benchmark's ExtractReuters created its temp dir wrongly if provided out-dir param ended by slash

Modified:
    lucene/dev/trunk/modules/benchmark/CHANGES.txt
    lucene/dev/trunk/modules/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java

Modified: lucene/dev/trunk/modules/benchmark/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/benchmark/CHANGES.txt?rev=1127436&r1=1127435&r2=1127436&view=diff
==============================================================================
--- lucene/dev/trunk/modules/benchmark/CHANGES.txt (original)
+++ lucene/dev/trunk/modules/benchmark/CHANGES.txt Wed May 25 08:50:16 2011
@@ -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.

Modified: lucene/dev/trunk/modules/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java?rev=1127436&r1=1127435&r2=1127436&view=diff
==============================================================================
--- lucene/dev/trunk/modules/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java (original)
+++ lucene/dev/trunk/modules/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java Wed May 25 08:50:16 2011
@@ -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>");
   }
   
 }