mirror of
https://github.com/apache/lucene.git
synced 2025-02-28 13:29:26 +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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user