mirror of https://github.com/apache/lucene.git
don't throw NPE if someone consumes us wrong, also null out random on close to be pickier
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1525719 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dabeab3b38
commit
764c248064
|
@ -104,11 +104,20 @@ public final class MockGraphTokenFilter extends LookaheadTokenFilter<LookaheadTo
|
|||
this.random = new Random(seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
super.close();
|
||||
this.random = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public 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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue