Commit fb018d2
committed
feat: lock skipLines once CSV parsing has started
skipLines(int) and skipLines(Predicate, int) operate on physical
lines and are intended for skipping non-CSV preamble before the
actual CSV data starts. Calling them after iteration has begun
can split a quoted field at an embedded newline and corrupt the
parser's view of subsequent records.
Track whether parsing has started (set in fetchRecord before the
first parse() call) and throw IllegalStateException from both
skipLines overloads if invoked after that point. Document the
throw contract on both methods.
No existing test calls skipLines after iteration starts, so this
is a tightening rather than a behaviour change for any documented
use case.
JMH: FastCsvReadBenchmark and FastCsvReadRelaxedBenchmark unchanged
within noise.1 parent 9c0d607 commit fb018d2
2 files changed
Lines changed: 41 additions & 0 deletions
File tree
- lib/src
- intTest/java/blackbox/reader
- main/java/de/siegmar/fastcsv/reader
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
302 | 320 | | |
303 | 321 | | |
304 | 322 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
98 | 105 | | |
99 | 106 | | |
100 | 107 | | |
101 | 108 | | |
| 109 | + | |
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
106 | 114 | | |
107 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
108 | 119 | | |
109 | 120 | | |
110 | 121 | | |
| |||
123 | 134 | | |
124 | 135 | | |
125 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
126 | 144 | | |
127 | 145 | | |
128 | 146 | | |
129 | 147 | | |
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
| 151 | + | |
133 | 152 | | |
134 | 153 | | |
135 | 154 | | |
136 | 155 | | |
137 | 156 | | |
138 | 157 | | |
139 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
140 | 162 | | |
141 | 163 | | |
142 | 164 | | |
| |||
222 | 244 | | |
223 | 245 | | |
224 | 246 | | |
| 247 | + | |
225 | 248 | | |
226 | 249 | | |
227 | 250 | | |
| |||
0 commit comments