Apache Lucene open-source search software
LUCENE-9894: Hunspell: add user-friendly diagnostics for morph data API misuse (#51)
Peter Gromov7f147fece083
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.javaindex 2be818812b1..2e83145ba2f 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java@@ -551,8 +551,9 @@ public class Dictionary {@Overridepublic List<String> getMorphologicalValues(int entryIndex, String key) {- assert key.length() == 3;- assert key.charAt(2) == ':';+ assert key.length() == 3 && key.charAt(2) == ':'+ : "A morphological data key should consist of two letters followed by a semicolon, found: "+ + key;String fields = getMorphologicalData(entryIndex);if (fields.isEmpty() || !fields.contains(key)) return Collections.emptyList();