ashishkumar50 commented on code in PR #4531:
URL: https://github.com/apache/ozone/pull/4531#discussion_r1166434573


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmDirectoryInfo.java:
##########
@@ -266,4 +267,26 @@ public OmDirectoryInfo copyObject() {
 
     return builder.build();
   }
+
+  /**
+   * Return a new copy of the object.
+   */
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    OmDirectoryInfo omDirectoryInfo = (OmDirectoryInfo) super.clone();
+
+    omDirectoryInfo.metadata = new HashMap<>();
+    omDirectoryInfo.acls = new ArrayList<>();
+
+    acls.stream().filter(acl -> acl != null).forEach(acl ->
+            omDirectoryInfo.acls.add(new OzoneAcl(acl.getType(),
+                    acl.getName(), (BitSet) acl.getAclBitSet().clone(),
+                    acl.getAclScope())));
+
+    if (metadata != null) {
+      metadata.forEach((k, v) -> omDirectoryInfo.metadata.put(k, v));

Review Comment:
   New Map is created and <k,v> are String, so i think it is fine as <k,v> are 
immutable.



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