lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r807682 - /lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java
Date Tue, 25 Aug 2009 15:58:00 GMT
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) {



Mime
View raw message