Fix NPE for TestRandomChains.testRandomChainsWithLargeStrings (#13104)

This commit is contained in:
Zhang Chao 2024-02-15 23:20:53 +08:00 committed by GitHub
parent f24b1de351
commit b16d7117a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -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");
}
/**