lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bmes...@apache.org
Subject cvs commit: jakarta-lucene/src/demo/org/apache/lucene/demo IndexFiles.java
Date Thu, 18 Nov 2004 18:54:13 GMT
bmesser     2004/11/18 10:54:13

  Modified:    src/demo/org/apache/lucene/demo IndexFiles.java
  Log:
  show a useful error message if the directory to index doesn't exist or isn't readable.
  
  Revision  Changes    Path
  1.6       +7 -1      jakarta-lucene/src/demo/org/apache/lucene/demo/IndexFiles.java
  
  Index: IndexFiles.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/demo/org/apache/lucene/demo/IndexFiles.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- IndexFiles.java	2 Sep 2004 21:45:23 -0000	1.5
  +++ IndexFiles.java	18 Nov 2004 18:54:13 -0000	1.6
  @@ -40,11 +40,17 @@
         System.exit(1);
       }
       
  +    final File docDir = new File(args[0]);
  +    if (!docDir.exists() || !docDir.canRead()) {
  +      System.out.println("Document directory '" +docDir.getAbsolutePath()+ "' does not
exist or is not readable, please check the path");
  +      System.exit(1);
  +    }
  +    
       Date start = new Date();
       try {
         IndexWriter writer = new IndexWriter(INDEX_DIR, new StandardAnalyzer(), true);
         System.out.println("Indexing to directory '" +INDEX_DIR+ "'...");
  -      indexDocs(writer, new File(args[0]));
  +      indexDocs(writer, docDir);
         System.out.println("Optimizing...");
         writer.optimize();
         writer.close();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message