Commit bc69af5
Enforce minimumLength >= 1 in JapaneseKatakanaStemFilter (LUCENE-10352 backport), #1072
Backport the upstream LUCENE-10352 constructor guard so JapaneseKatakanaStemFilter
rejects a minimumLength less than 1, matching apache/lucene
(JapaneseKatakanaStemFilter.java: "minimumLength must be >=1"). This replaces the
prior Stem() length==0 guard from the previous commit with the upstream approach.
A minimumLength of 0 let a zero-length token (e.g. the single empty token a
KeywordTokenizer emits for empty input) skip the "length < minimumKatakanaLength"
check in Stem(), after which the term[length - 1] access read term[-1] and threw
IndexOutOfRangeException. Enforcing minimumLength >= 1 in the constructor prevents
that configuration from being built at all, which is how upstream resolved it.
This was the residual TestRandomChains failure reported on PR #1348 (seeds
0x951afd480395f9b7:0x63fc16274945f1a3 / es-419 and
0xa4b2f7f450b03294:0x9fdf3b0c216c251e / lt-LT): the random arg producer can yield
minimumLength of 0, and TestRandomChains already discards constructors that throw
ArgumentOutOfRangeException, so the offending chain is simply skipped.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent a4cac05 commit bc69af5
2 files changed
Lines changed: 15 additions & 29 deletions
File tree
- src
- Lucene.Net.Analysis.Kuromoji
- Lucene.Net.Tests.Analysis.Kuromoji
Lines changed: 5 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | 88 | | |
99 | 89 | | |
100 | 90 | | |
| |||
Lines changed: 10 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
| 113 | + | |
115 | 114 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 115 | + | |
121 | 116 | | |
122 | | - | |
| 117 | + | |
| 118 | + | |
123 | 119 | | |
124 | 120 | | |
125 | 121 | | |
0 commit comments