Jzjsnow commented on code in PR #3664:
URL: https://github.com/apache/amoro/pull/3664#discussion_r2196802533


##########
amoro-common/src/main/java/org/apache/amoro/resource/ResourceGroup.java:
##########
@@ -81,13 +84,24 @@ public String getContainer() {
       return container;
     }
 
+    @VisibleForTesting
     public Builder addProperty(String key, String value) {
       this.properties.put(key, value);
       return this;
     }
 
     public Builder addProperties(Map<String, String> properties) {
-      this.properties.putAll(properties);
+      // Both keys and values will be trimmed of leading and trailing 
whitespace.
+      // Entries with empty (after trim) keys will be ignored.
+      // If duplicate keys exist after trimming, the latter value will 
overwrite the former.
+      this.properties.putAll(
+          properties.entrySet().stream()
+              .map(
+                  e ->
+                      new AbstractMap.SimpleEntry<>(
+                          e.getKey().trim(), e.getValue() == null ? null : 
e.getValue().trim()))

Review Comment:
   Thanks for the suggestion, I have instead sanitised it in the controller and 
extracted the logic into PropertiesUtil for reuse.



-- 
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: commits-unsubscr...@amoro.apache.org

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

Reply via email to