rootvector2 commented on PR #427:
URL:
https://github.com/apache/commons-beanutils/pull/427#issuecomment-5100707823
The surprising part is what happens today: nobody gets two elements. Before
the patch `"first/value,second/value"` parses to `["first"]`, so the real
choice is between 1 element (silent data loss) and the behavior every other
char already has, not between 2 and 4.
Four matches the `_` precedent exactly: `testUnderscore_BEANUTILS_302` pins
`"first_value,second_value"` to 4 elements by default and to `["first_value",
"second_value"]` after `setAllowedChars(new char[] { '.', '-', '_' })`. The
patch makes `/` follow that same rule, and the new test mirrors the underscore
test, including the `setAllowedChars(new char[] { '.', '-', '/' })` case, which
yields exactly the two elements you describe.
On `//` and `/* ... */`: `parseElements` never enables
`slashSlashComments`/`slashStarComments` (both off by default), so the only
live comment syntax was the single-char comment `/` set by the
`StreamTokenizer` constructor. That's also why truncation starts at the first
`/` no matter what follows. `ordinaryChar('/')` clears that flag, so after the
patch no comment handling remains at all.
If you'd rather plain input give `["first/value", "second/value"]` with no
configuration, I can add `/` to the default `allowedChars` instead. That also
keeps the data intact, it just treats `/` differently from `_`. Your call.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]