TaiJuWu commented on code in PR #20134:
URL: https://github.com/apache/kafka/pull/20134#discussion_r2214995324


##########
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##########
@@ -1469,7 +1470,24 @@ public static <K, V> Map<K, V> filterMap(final Map<K, V> 
map, final Predicate<En
      * @return a map including all elements in properties
      */
     public static Map<String, Object> propsToMap(Properties properties) {
-        return castToStringObjectMap(properties);
+        // This try catch block is to handle the case when the Properties 
object has non-String keys
+        // when calling the propertyNames() method. This is a workaround for 
the lack of a method that
+        // returns all properties including defaults and does not attempt to 
convert all keys to Strings.
+        Enumeration<?> enumeration;
+        try {
+            enumeration = properties.propertyNames();
+        } catch (ClassCastException e) {
+            throw new ConfigException("One or more keys is not a string.");
+        }

Review Comment:
   You are right, we don't need additional test for it, thanks for your 
explanation.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to