From 51dc4159e6c4ed708cbcf8d18a543b57beb0037f Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Wed, 26 Jan 2011 23:40:08 +0000 Subject: [PATCH] SOLR-1283: fix numRead counter that caused mark invalid exceptions git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1063920 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/lucene/analysis/charfilter/HTMLStripCharFilter.java | 1 + .../lucene/analysis/charfilter/HTMLStripCharFilterTest.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java b/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java index 4ab01ab0d32..87591992e1f 100644 --- a/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java +++ b/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java @@ -101,6 +101,7 @@ public class HTMLStripCharFilter extends BaseCharFilter { if (len>0) { return pushed.charAt(len-1); } + numRead++; int ch = input.read(); push(ch); return ch; diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java index 604f9668d53..f1af45ab350 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java +++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java @@ -169,7 +169,7 @@ public class HTMLStripCharFilterTest extends LuceneTestCase { public void testBufferOverflow() throws Exception { StringBuilder testBuilder = new StringBuilder(HTMLStripCharFilter.DEFAULT_READ_AHEAD + 50); - testBuilder.append("ah "); + testBuilder.append("ah ??????"); appendChars(testBuilder, HTMLStripCharFilter.DEFAULT_READ_AHEAD + 500); processBuffer(testBuilder.toString(), "Failed on pseudo proc. instr.");//processing instructions