kumaab commented on code in PR #837:
URL: https://github.com/apache/ranger/pull/837#discussion_r2757018659


##########
agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java:
##########
@@ -921,7 +921,13 @@ public RangerPolicyItem() {
         }
 
         public RangerPolicyItem(RangerPolicyItem other) {
-            this(other.accesses, other.users, other.groups, other.roles, 
other.conditions, other.delegateAdmin);
+            this.accesses   = other.accesses == null ? new ArrayList<>() : new 
ArrayList<>(other.accesses);
+            this.users      = other.users == null ? new ArrayList<>() : new 
ArrayList<>(other.users);
+            this.groups     = other.groups == null ? new ArrayList<>() : new 
ArrayList<>(other.groups);
+            this.roles      = other.roles == null ? new ArrayList<>() : new 
ArrayList<>(other.roles);
+            this.conditions = other.accesses == null ? new ArrayList<>() : new 
ArrayList<>(other.conditions);

Review Comment:
   maybe this meant check on `conditions` ?



##########
agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java:
##########
@@ -921,7 +921,13 @@ public RangerPolicyItem() {
         }
 

Review Comment:
   Might be useful to use:
   
   ```
   private static <T> List<T> copyOrEmpty(List<T> src) {
       return src == null ? new ArrayList<>() : new ArrayList<>(src);
   }
   
   ```



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