Chris M. Hostetter created KAFKA-17770:
------------------------------------------

             Summary: 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


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)

Reply via email to