mirror of
https://github.com/apache/lucene.git
synced 2025-02-28 05:19:17 +00:00
LUCENE-10024: Catch NoSuchFileException when opening index directory
This commit is contained in:
parent
982b95e38e
commit
489ba3e4f9
@ -18,6 +18,7 @@
|
||||
package org.apache.lucene.luke.app;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.util.Objects;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
@ -71,6 +72,12 @@ public final class IndexHandler extends AbstractHandler<IndexObserver> {
|
||||
IndexReader reader;
|
||||
try {
|
||||
reader = IndexUtils.openIndex(indexPath, dirImpl);
|
||||
} catch (NoSuchFileException e) {
|
||||
log.error("Error opening index", e);
|
||||
throw new LukeException(
|
||||
MessageUtils.getLocalizedMessage(
|
||||
"openindex.message.index_path_does_not_exist", indexPath),
|
||||
e);
|
||||
} catch (Exception e) {
|
||||
log.error("Error opening index", e);
|
||||
throw new LukeException(
|
||||
|
@ -71,6 +71,7 @@ openindex.radio.keep_only_last_commit=Keep only last commit point
|
||||
openindex.radio.keep_all_commits=Keep all commit points
|
||||
openindex.message.index_path_not_selected=Please choose index path.
|
||||
openindex.message.index_path_invalid=Cannot open index path {0}. Not a valid lucene index directory or corrupted?
|
||||
openindex.message.index_path_does_not_exist=Cannot open index path {0}. No such directory!
|
||||
openindex.message.index_opened=Index successfully opened.
|
||||
openindex.message.index_opened_ro=Index successfully opened. (read-only)
|
||||
openindex.message.index_opened_multi=Index successfully opened. (multi-reader)
|
||||
@ -289,4 +290,4 @@ help.fieldtype.SortedSetDocValuesField=Field that stores a set of per-document B
|
||||
help.fieldtype.NumericDocValuesField=Field that stores a per-document long value for scoring, sorting or value retrieval.\nIf you also need to store the value, you should add a separate StoredField instance.\nDoubles or Floats will be encoded with org.apache.lucene.util.NumericUtils.\n\n(Example Values)\n- 42\n- 3.14
|
||||
help.fieldtype.SortedNumericDocValuesField=Field that stores a per-document long values for scoring, sorting or value retrieval.\nIf you also need to store the value, you should add a separate StoredField instance.\nDoubles or Floats will be encoded with org.apache.lucene.util.NumericUtils.\n\n(Example Values)\n- 42\n- 3.14
|
||||
help.fieldtype.StoredField=A field whose value is stored.\n\n(Example Values)\n- Hello Lucene!
|
||||
help.fieldtype.Field=Expert: directly create a field for a document. Most users should use one of the sugar subclasses above.
|
||||
help.fieldtype.Field=Expert: directly create a field for a document. Most users should use one of the sugar subclasses above.
|
||||
|
Loading…
x
Reference in New Issue
Block a user