You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by to...@apache.org on 2021/07/17 04:48:23 UTC
[lucene] branch main updated: LUCENE-10024: Catch
NoSuchFileException when opening index directory
This is an automated email from the ASF dual-hosted git repository.
tomoko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 489ba3e LUCENE-10024: Catch NoSuchFileException when opening index directory
489ba3e is described below
commit 489ba3e4f90236a6c2839c4c372b1218463d5839
Author: Michael Wechner <mi...@wyona.com>
AuthorDate: Sat Jul 17 13:43:12 2021 +0900
LUCENE-10024: Catch NoSuchFileException when opening index directory
---
lucene/luke/src/java/org/apache/lucene/luke/app/IndexHandler.java | 7 +++++++
.../apache/lucene/luke/app/desktop/messages/messages.properties | 3 ++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/lucene/luke/src/java/org/apache/lucene/luke/app/IndexHandler.java b/lucene/luke/src/java/org/apache/lucene/luke/app/IndexHandler.java
index f3fc635..4f1ee8f 100644
--- a/lucene/luke/src/java/org/apache/lucene/luke/app/IndexHandler.java
+++ b/lucene/luke/src/java/org/apache/lucene/luke/app/IndexHandler.java
@@ -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(
diff --git a/lucene/luke/src/resources/org/apache/lucene/luke/app/desktop/messages/messages.properties b/lucene/luke/src/resources/org/apache/lucene/luke/app/desktop/messages/messages.properties
index f9c8c45..30b43cf 100644
--- a/lucene/luke/src/resources/org/apache/lucene/luke/app/desktop/messages/messages.properties
+++ b/lucene/luke/src/resources/org/apache/lucene/luke/app/desktop/messages/messages.properties
@@ -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.
\ No newline at end of file
+help.fieldtype.Field=Expert: directly create a field for a document. Most users should use one of the sugar subclasses above.