You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by us...@apache.org on 2009/08/25 17:58:00 UTC

svn commit: r807682 - /lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java

Author: uschindler
Date: Tue Aug 25 15:58:00 2009
New Revision: 807682

URL: http://svn.apache.org/viewvc?rev=807682&view=rev
Log:
onlyUseNewAPI is a static, so non-instance variable. It is used only to initialize TokenStreams and can be changed after. Because of that the tests in incrementToken()/next()/next(Token) should not use it. It is enough to test for tokenWrapper==null to detect a onlyNewAPI TokenStream instance.

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java?rev=807682&r1=807681&r2=807682&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java Tue Aug 25 15:58:00 2009
@@ -305,7 +305,7 @@
    *         3.0.</b>
    */
   public boolean incrementToken() throws IOException {
-    assert !onlyUseNewAPI && tokenWrapper != null;
+    assert tokenWrapper != null;
     
     final Token token;
     if (supportedMethods.hasReusableNext) {
@@ -369,7 +369,7 @@
   public Token next(final Token reusableToken) throws IOException {
     assert reusableToken != null;
     
-    if (onlyUseNewAPI)
+    if (tokenWrapper == null)
       throw new UnsupportedOperationException("This TokenStream only supports the new Attributes API.");
     
     if (supportedMethods.hasIncrementToken) {
@@ -393,7 +393,7 @@
    *             method with the new {@link AttributeSource} API.
    */
   public Token next() throws IOException {
-    if (onlyUseNewAPI)
+    if (tokenWrapper == null)
       throw new UnsupportedOperationException("This TokenStream only supports the new Attributes API.");
     
     if (supportedMethods.hasIncrementToken) {