You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2024/02/15 15:20:59 UTC

(lucene) branch main updated: Fix NPE for TestRandomChains.testRandomChainsWithLargeStrings (#13104)

This is an automated email from the ASF dual-hosted git repository.

uschindler 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 b16d7117a3b Fix NPE for TestRandomChains.testRandomChainsWithLargeStrings (#13104)
b16d7117a3b is described below

commit b16d7117a3b3ab1307ecebd11b2c983b50c265d9
Author: Zhang Chao <80...@qq.com>
AuthorDate: Thu Feb 15 23:20:53 2024 +0800

    Fix NPE for TestRandomChains.testRandomChainsWithLargeStrings (#13104)
---
 .../src/java/org/apache/lucene/analysis/shingle/ShingleFilter.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/ShingleFilter.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/ShingleFilter.java
index 1eb4357eef1..e9520815dad 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/ShingleFilter.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/ShingleFilter.java
@@ -19,6 +19,7 @@ package org.apache.lucene.analysis.shingle;
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.LinkedList;
+import java.util.Objects;
 import org.apache.lucene.analysis.TokenFilter;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
@@ -175,7 +176,7 @@ public final class ShingleFilter extends TokenFilter {
    * @param tokenType token tokenType
    */
   public void setTokenType(String tokenType) {
-    this.tokenType = tokenType;
+    this.tokenType = Objects.requireNonNull(tokenType, "tokenType");
   }
 
   /**