Yunyung commented on code in PR #20134: URL: https://github.com/apache/kafka/pull/20134#discussion_r2195936947
########## clients/src/main/java/org/apache/kafka/common/utils/Utils.java: ########## @@ -1469,7 +1470,19 @@ 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); + try { + final Enumeration<?> enumeration = properties.propertyNames(); + Map<String, Object> props = new HashMap<>(); + while (enumeration.hasMoreElements()) { + Object key = enumeration.nextElement(); + String keyString = (String) key; + Object value = (properties.get(keyString) != null) ? properties.get(keyString) : properties.getProperty(keyString); + props.put(keyString, value); + } + return props; + } catch (Exception e) { + throw new ConfigException("Key must be a string."); + } Review Comment: In any case, let's also add the unit test for the exception thrown. -- 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