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


##########
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:
   Can you trim the properties in the controller? I think it would be better to 
sanitize the input values either in the frontend or within the controller layer.



-- 
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]

Reply via email to