Commit 04dd7ad
committed
Fix command line parameter parsing to support values containing commas
The parameter format is: key=value,type,identifying
Previously, the parser split on ALL commas, which broke when values
contained commas. For example, "items=apple,banana,orange" would be
incorrectly parsed, treating "banana" as a type name.
This commit adds intelligent parsing that:
1. Checks if the second-to-last token looks like a class name
2. If yes, treats everything before it as the value (which may contain commas)
3. If no, treats the entire string as the value with commas included
The heuristic "looks like a class name" checks for:
- Fully qualified class names (contain dots like java.lang.String)
- Primitive types (int, long, double, etc.)
This allows values containing commas to work correctly while
maintaining backward compatibility with existing parameter formats.
Fixes #53291 parent 258da33 commit 04dd7ad
File tree
2 files changed
+103
-5
lines changed- spring-batch-core/src
- main/java/org/springframework/batch/core/converter
- test/java/org/springframework/batch/core/converter
2 files changed
+103
-5
lines changedLines changed: 81 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
179 | 208 | | |
180 | 209 | | |
181 | 210 | | |
182 | 211 | | |
183 | 212 | | |
184 | 213 | | |
185 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
186 | 235 | | |
187 | | - | |
188 | | - | |
| 236 | + | |
189 | 237 | | |
190 | 238 | | |
191 | | - | |
| 239 | + | |
192 | 240 | | |
193 | 241 | | |
194 | 242 | | |
| |||
197 | 245 | | |
198 | 246 | | |
199 | 247 | | |
200 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
201 | 277 | | |
202 | 278 | | |
203 | 279 | | |
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
343 | 365 | | |
0 commit comments