[
https://issues.apache.org/jira/browse/KAFKA-17770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17888484#comment-17888484
]
Chris M. Hostetter commented on KAFKA-17770:
--------------------------------------------
{quote}... and set up some testing *or linting* that would have found this.
{quote}
I almost forgot: While randomized testing is a great way to help detect Locale
sensitivity _in general_ (particularly in 3rd party dependencies) the
{{forbidden-apis}} tool is a great build time check to prevent people from
committing calls to known bad methods...
[https://github.com/policeman-tools/forbidden-apis]
...it even has build in "signature" files for any calls in the JDK that use the
default locale, charset, etc...
[https://github.com/policeman-tools/forbidden-apis/blob/main/src/main/resources/de/thetaphi/forbiddenapis/signatures/jdk-unsafe-1.7.txt#L52]
> system default Locale sensitivity in scala code uppercasing enums
> -----------------------------------------------------------------
>
> Key: KAFKA-17770
> URL: https://issues.apache.org/jira/browse/KAFKA-17770
> Project: Kafka
> Issue Type: Bug
> Reporter: Chris M. Hostetter
> Priority: Major
>
> Code that invokes {{kafka.server.KafkaConfig}} can encounter "No enum
> constant" for values that (IIUC) come from implicit defaults – {_}When the
> system default Locale has uppercase rules that differ from English{_}!
> This may not affect most kafka server deployments, but it can easily come up
> when using embedded kafka for testing purposes – especially in downstream
> projects that [explicitly randomize their locales
> |http://labs.carrotsearch.com/randomizedtesting.html]to check for behavior
> like this.
> Below is an example stack trace from a test that uses
> {{org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster}} (with no
> custom configuration) when using the "az" locale (Similar errors can happen
> with the "tr-TR" locale, etc...)
> Note that the "I" in {{GroupType.CLASSİC}} is actually {{U+0130}} (not
> {{{}U+0049{}}})
> {noformat}
> > java.lang.IllegalArgumentException: No enum constant
> org.apache.kafka.coordinator.group.Group.GroupType.CLASSİC
> > at java.base/java.lang.Enum.valueOf(Enum.java:273)
> > at
> org.apache.kafka.coordinator.group.Group$GroupType.valueOf(Group.java:29)
> > at
> kafka.server.KafkaConfig.$anonfun$groupCoordinatorRebalanceProtocols$2(KafkaConfig.scala:2020)
> > at
> scala.collection.StrictOptimizedIterableOps.map(StrictOptimizedIterableOps.scala:100)
> > at
> scala.collection.StrictOptimizedIterableOps.map$(StrictOptimizedIterableOps.scala:87)
> > at scala.collection.mutable.ArrayBuffer.map(ArrayBuffer.scala:43)
> > at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:2020)
> > at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1639)
> > at
> org.apache.kafka.streams.integration.utils.KafkaEmbedded.<init>(KafkaEmbedded.java:72)
> > at
> org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster.start(EmbeddedKafkaCluster.java:131)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)