basil commented on code in PR #364:
URL: https://github.com/apache/commons-beanutils/pull/364#discussion_r2267911120
##########
src/main/java/org/apache/commons/beanutils2/converters/ColorConverter.java:
##########
@@ -90,42 +90,38 @@ protected <T> T convertToType(final Class<T> type, final
Object value) throws Th
if (Color.class.isAssignableFrom(type)) {
final String stringValue = toString(value);
- switch (toLowerCase(stringValue)) {
- case "black":
+ if (stringValue.equalsIgnoreCase("black")) {
return type.cast(Color.BLACK);
- case "blue":
+ } else if (stringValue.equalsIgnoreCase("blue")) {
Review Comment:
> I think we first need to clarify **what** we’re trying to achieve here,
because Unicode case-insensitive comparison is not a trivial problem.
@ppkarwasz Thanks for asking! As stated in the PR description, this is a
code simplification PR. The goal I am trying to achieve is a net simplification
without any regressions in correctness and without (significant) regressions in
performance.
> If our goal is to support localized color names
That is not the goal in this PR. The `java.awt.Color` has no knowledge of
locales, and I see no compelling reason to support color translation as part of
this library.
--
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]