GJL commented on a change in pull request #9672: [FLINK-14047][rest] Let JobConfigHandler replace sensitive values from user configuration URL: https://github.com/apache/flink/pull/9672#discussion_r323221153
########## File path: flink-core/src/main/java/org/apache/flink/configuration/ConfigurationUtils.java ########## @@ -143,6 +145,30 @@ public static Configuration createConfiguration(Properties properties) { return configuration; } + /** + * Replaces values whose keys are sensitive according to {@link GlobalConfiguration#isSensitive(String)} + * with {@link GlobalConfiguration#HIDDEN_CONTENT}. + * + * <p>This can be useful when displaying configuration values. + * + * @param keyValuePairs for which to hide sensitive values + * @return A map where all sensitive value are hidden + */ + @Nonnull + public static Map<String, String> hideSensitiveValues(Map<String, String> keyValuePairs) { + final HashMap<String, String> result = new HashMap<>(keyValuePairs.size()); Review comment: It may be copied but it violates: > Set the initial capacity for a collection only if there is a good proven reason for that, otherwise do not clutter the code. In case of Maps it can be even deluding because the Map’s load factor effectively reduces the capacity. https://flink.apache.org/contributing/code-style-and-quality-java.html#collections ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services