Apache Lucene open-source search software
don't throw NPE if someone consumes us wrong, also null out random on close to be pickier
Robert Muir764c248064fe
diff --git a/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java b/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.javaindex 30c49feed8e..35f14b42936 100644--- a/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java+++ b/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java@@ -104,11 +104,20 @@ public final class MockGraphTokenFilter extends LookaheadTokenFilter<LookaheadTothis.random = new Random(seed);}+ @Override+ public void close() throws IOException {+ super.close();+ this.random = null;+ }+@Overridepublic boolean incrementToken() throws IOException {if (DEBUG) {System.out.println("MockGraphTF.incr inputPos=" + inputPos + " outputPos=" + outputPos);}+ if (random == null) {+ throw new IllegalStateException("incrementToken called in wrong state!");+ }return nextToken();}}