LUCENE-3897: fix silly bug in forced backtrace

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1305086 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-03-25 17:51:26 +00:00
parent 7a43dc7432
commit a278ba7a0c
2 changed files with 11 additions and 1 deletions

View File

@ -648,7 +648,7 @@ public final class KuromojiTokenizer extends Tokenizer {
final Position posData2 = positions.get(pos2);
for(int idx=0;idx<posData2.count;idx++) {
//System.out.println(" idx=" + idx + " cost=" + cost);
final int cost = posData.costs[idx];
final int cost = posData2.costs[idx];
if (cost < leastCost) {
leastCost = cost;
leastIDX = idx;

View File

@ -153,4 +153,14 @@ public class TestKuromojiAnalyzer extends BaseTokenStreamTestCase {
new Integer(4)
);
}
// LUCENE-3897: this string (found by running all jawiki
// XML through KuromojiAnalyzer) caused AIOOBE
public void testCuriousString() throws Exception {
final String s = "&lt;li&gt;06:26 2004年3月21日 [[利用者:Kzhr|Kzhr]] &quot;お菓子な家族&quot; を削除しました &lt;em&gt;&lt;nowiki&gt;(即時削除: 悪戯。内容: &amp;#39;&amp;#39;)&lt;/nowiki&gt;&lt;/em&gt;&lt;/li&gt;";
final Analyzer a = new KuromojiAnalyzer(TEST_VERSION_CURRENT, null, Mode.SEARCH,
KuromojiAnalyzer.getDefaultStopSet(),
KuromojiAnalyzer.getDefaultStopTags());
checkAnalysisConsistency(random, a, random.nextBoolean(), s);
}
}