adoroszlai commented on code in PR #4271:
URL: https://github.com/apache/ozone/pull/4271#discussion_r1119627631


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java:
##########
@@ -776,4 +779,22 @@ public static 
ContainerProtos.ContainerCommandResponseProto processForDebug(
 
     return msg;
   }
+
+  /**
+   * Redacts sensitive configuration.
+   * Sorts all properties by key name
+   *
+   * @param conf OzoneConfiguration object to be printed.
+   * @return Sorted Map of properties
+   */
+  public static Map<String, String> processForLogging(OzoneConfiguration conf) 
{
+    Map<String, String> ozoneProps = conf.getOzoneProperties();
+    ConfigRedactor redactor = new ConfigRedactor(conf);
+    Map<String, String> sortedOzoneProps = new TreeMap<>();
+    for (String name : ozoneProps.keySet()) {
+      String value = redactor.redact(name, ozoneProps.get(name));
+      sortedOzoneProps.put(name, value);

Review Comment:
   Findbugs complains:
   
   ```
   M P WMI: 
org.apache.hadoop.hdds.HddsUtils.processForLogging(OzoneConfiguration) makes 
inefficient use of keySet iterator instead of entrySet iterator  At 
HddsUtils.java:[line 795]
   ```
   
   
https://github.com/apache/ozone/actions/runs/4288734741/jobs/7471080023#step:6:2053
   
   Can be fixed by:
   
   ```suggestion
       for (Map.Entry<String, String> entry : ozoneProps.entrySet()) {
         String value = redactor.redact(entry.getKey(), entry.getValue());
         sortedOzoneProps.put(entry.getKey(), value);
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to