slfan1989 commented on code in PR #8995:
URL: https://github.com/apache/hadoop/pull/8995#discussion_r4576825682


##########
hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/CopyListingFileStatus.java:
##########
@@ -255,7 +257,7 @@ public Map<String, byte[]> getXAttrs() {
    * @param xAttrs Map containing all xAttrs
    */
   public void setXAttrs(Map<String, byte[]> xAttrs) {
-    this.xAttrs = xAttrs;
+    this.xAttrs = xAttrs == null ? null : new LinkedHashMap<>(xAttrs);

Review Comment:
   Is sharing the XAttr value arrays intentional here? The map copy still lets 
a caller change the bytes written to the copy listing by mutating an input 
array after `setXAttrs()`. If we want the listing to hold an independent copy, 
could we clone the non-null values and add a test that mutates the original 
array?



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