FK-Christian opened a new pull request, #5639: URL: https://github.com/apache/fineract/pull/5639
## Description
Summary
- Added explicit Locale.US to all toLowerCase() calls in
EnumValueValidator to avoid locale-dependent behaviour.
- Fixed the String.format(String, Object...) compiler warning by
specifying Locale.US as the first argument.
- Improved the constraint violation message to include the rejected value
and the full list of accepted enum values, replacing the generic
annotation-level message.
Motivation
Calling String.toLowerCase() and String.format() without an explicit
Locale produces compiler warnings and can yield inconsistent results on systems
with a non-English default
locale (e.g. Turkish, where I lowercases to ı rather than i). Since enum
constant names are always ASCII, Locale.US is the correct and safe choice here.
Changes
EnumValueValidator.java
- Added Locale.US to toLowerCase() calls
- Added String.format(Locale.US, ...) for the constraint violation message
- Added import java.util.Locale
Test plan
- Existing unit/integration tests pass.
- Manually verify that an invalid enum value returns a descriptive message
listing the accepted values.
- Verify no new compiler warnings are raised by static analysis.
--
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]
