From 4deb0003c425bfaff3923661512c44a315172854 Mon Sep 17 00:00:00 2001 From: Alessandro Benedetti Date: Mon, 24 Apr 2023 17:28:12 +0200 Subject: [PATCH] Word2VecSynonymFilter constructor null check (#12169) --- .../analysis/synonym/word2vec/Word2VecSynonymFilter.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/word2vec/Word2VecSynonymFilter.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/word2vec/Word2VecSynonymFilter.java index 29f9d37d5fd..6088d8d6efc 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/word2vec/Word2VecSynonymFilter.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/word2vec/Word2VecSynonymFilter.java @@ -65,6 +65,9 @@ public final class Word2VecSynonymFilter extends TokenFilter { int maxSynonymsPerTerm, float minAcceptedSimilarity) { super(input); + if (synonymProvider == null) { + throw new IllegalArgumentException("The SynonymProvider must be non-null"); + } this.synonymProvider = synonymProvider; this.maxSynonymsPerTerm = maxSynonymsPerTerm; this.minAcceptedSimilarity = minAcceptedSimilarity;