chia7712 commented on PR #20134: URL: https://github.com/apache/kafka/pull/20134#issuecomment-3084874736
> I'm not sure that it's possible to fix castToStringObjectMap, since it takes a Map<?, ?>, and the fix requires the use of properties.propertyNames() or properties.stringPropertyNames() in order to properly access the default properties. Perhaps we can use `instanceof`? for example: ```java public static Map<String, Object> castToStringObjectMap(Map<?, ?> inputMap) { // HERE if (inputMap instanceof Properties) return propsToMap((Properties) inputMap); Map<String, Object> map = new HashMap<>(inputMap.size()); for (Map.Entry<?, ?> entry : inputMap.entrySet()) { if (entry.getKey() instanceof String) { String k = (String) entry.getKey(); map.put(k, entry.getValue()); } else { throw new ConfigException(String.valueOf(entry.getKey()), entry.getValue(), "Key must be a string."); } } return map; } ``` WDYT? -- 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