mirror of
https://github.com/apache/lucene.git
synced 2025-03-04 15:29:28 +00:00
show a useful error message if the directory to index doesn't exist or isn't readable.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150647 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
34c106218e
commit
d9f00f1d09
@ -40,11 +40,17 @@ class IndexFiles {
|
||||
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user