You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2018/05/11 14:08:10 UTC
[2/2] lucene-solr:master: LUCENE-8273: Fix end() propagation
LUCENE-8273: Fix end() propagation
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/2225d0e4
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2225d0e4
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2225d0e4
Branch: refs/heads/master
Commit: 2225d0e464eeeabcec682edcabd51b136ac1aee2
Parents: d764156
Author: Alan Woodward <ro...@apache.org>
Authored: Fri May 11 15:07:31 2018 +0100
Committer: Alan Woodward <ro...@apache.org>
Committed: Fri May 11 15:07:59 2018 +0100
----------------------------------------------------------------------
.../analysis/miscellaneous/ConditionalTokenFilter.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2225d0e4/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConditionalTokenFilter.java
----------------------------------------------------------------------
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConditionalTokenFilter.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConditionalTokenFilter.java
index f6f2a54..e11530d 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConditionalTokenFilter.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConditionalTokenFilter.java
@@ -64,14 +64,15 @@ public abstract class ConditionalTokenFilter extends TokenFilter {
@Override
public void end() throws IOException {
- // clearing attributes etc is done by the parent stream,
- // so must be avoided here
+ endCalled = true;
+ ConditionalTokenFilter.this.end();
}
}
private final TokenStream delegate;
private TokenState state = TokenState.READING;
private boolean lastTokenFiltered;
+ private boolean endCalled;
/**
* Create a new BypassingTokenFilter
@@ -94,12 +95,13 @@ public abstract class ConditionalTokenFilter extends TokenFilter {
this.delegate.reset();
this.state = TokenState.READING;
this.lastTokenFiltered = false;
+ this.endCalled = false;
}
@Override
public void end() throws IOException {
super.end();
- if (lastTokenFiltered) {
+ if (endCalled == false && lastTokenFiltered) {
this.delegate.end();
}
}