You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "rootvector2 (via GitHub)" <gi...@apache.org> on 2026/06/27 19:45:29 UTC
[PR] Reject out-of-range values in LongLocaleConverter (1.X) [commons-beanutils]
rootvector2 opened a new pull request, #407:
URL: https://github.com/apache/commons-beanutils/pull/407
Port of #406 to the `1.X` branch.
`LongLocaleConverter.parse` narrows the parsed number with `result.longValue()` and never range-checks it, so a value beyond `long` range like `99999999999999999999` is silently clamped to `Long.MAX_VALUE` instead of rejected: `DecimalFormat` returns it as a `Double` (the converter does not set `parseBigDecimal`) and `Double.longValue()` saturates.
The sibling narrowing locale converters `IntegerLocaleConverter`, `ByteLocaleConverter`, `ShortLocaleConverter` and `FloatLocaleConverter` already reject out-of-range input, so `LongLocaleConverter` gets the same bounds check before narrowing. Found while auditing the locale converter family against those sibling checks.
Added a regression test to `LongLocaleConverterTest`; it fails without the runtime change (`99999999999999999999` comes back as `9223372036854775807`). `mvn test -Dtest='*LocaleConverterTest'` is green (107 tests).
- [x] Read the [contribution guidelines](CONTRIBUTING.md) for this project.
- [ ] Read the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) if you use Artificial Intelligence (AI).
- [ ] I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute?
- [x] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself.
- [x] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.
--
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: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reject out-of-range values in LongLocaleConverter (1.X) [commons-beanutils]
Posted by "rootvector2 (via GitHub)" <gi...@apache.org>.
rootvector2 commented on PR #407:
URL: https://github.com/apache/commons-beanutils/pull/407#issuecomment-4886482099
Traced it. The warnings come from the `commons-collections4` 4.5.0 tests jar, not from beanutils: `BeanMapTest` extends `org.apache.commons.collections4.map.AbstractMapTest`, and in 4.5.0 its `TestMapEntrySet`/`TestMapKeySet`/`TestMapValues` are concrete non-static inner classes left over from the JUnit 3 `BulkTest` mechanism. JUnit platform 5.13+ flags inherited member classes that have test methods but are neither static nor `@Nested`, so they show up whenever `BeanMapTest` is discovered. The warning is accurate, those entrySet/keySet/values suites don't actually run under Jupiter with 4.5.0.
Already fixed on collections master: apache/commons-collections#681 and apache/commons-collections#689 (COLLECTIONS-884) renamed them to `MapEntrySetTest`/`MapKeySetTest`/`MapValuesTest` and made them `@Nested`, so the warnings go away once beanutils picks up collections4 4.6.0. One thing to watch: at that point the view suites will start executing against `BeanMap`, so the bump may need some test adjustments.
Reproduced on `1.X` with `mvn test -Dtest=BeanMapTest`; surefire puts the log in the `*-output.txt` reports rather than the console.
--
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: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org