You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2013/09/24 00:25:17 UTC

svn commit: r1525719 - /lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java

Author: rmuir
Date: Mon Sep 23 22:25:17 2013
New Revision: 1525719

URL: http://svn.apache.org/r1525719
Log:
don't throw NPE if someone consumes us wrong, also null out random on close to be pickier

Modified:
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java?rev=1525719&r1=1525718&r2=1525719&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java Mon Sep 23 22:25:17 2013
@@ -105,10 +105,19 @@ public final class MockGraphTokenFilter 
   }
 
   @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();
   }
 }