dlmarion commented on code in PR #5293:
URL: https://github.com/apache/accumulo/pull/5293#discussion_r1935561163


##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -502,7 +520,36 @@ public ColumnVisibility(Text expression) {
    * @see #ColumnVisibility(String)
    */
   public ColumnVisibility(byte[] expression) {
-    validate(expression);
+    this(expression, true);
+  }
+
+  /**
+   * Creates a column visibility for a mutation from a string already encoded 
in UTF-8 bytes. Allows
+   * validation to be skipped for use with accumulo-access AccessExpressions
+   *
+   * @param expression visibility expression, encoded as UTF-8 bytes
+   * @param validate enables or disables validation and parse tree generation
+   */
+  private ColumnVisibility(byte[] expression, boolean validate) {
+    if (validate) {
+      validate(expression);
+    } else {
+      this.expression = Arrays.copyOf(expression, expression.length);
+      this.node = EMPTY_NODE;
+    }
+  }
+
+  /**
+   * Creates a new column visibility by performing a deep copy of an existing 
column visibility
+   * object
+   *
+   * @param visibility ColumnVisibility object
+   * @since 2.1.4
+   */
+  public ColumnVisibility(ColumnVisibility visibility) {
+    byte[] incomingExpression = visibility.expression;
+    this.expression = Arrays.copyOf(incomingExpression, 
incomingExpression.length);
+    this.node = new Node(visibility.node);

Review Comment:
   It's possible that doing the following may help the issue I raised above:
   
   1. Modify `Node.children` to be `Collections.synchronizedList(new 
ArrayList<>())` in `Node.add`
   2. synchronize on visibility.node in the copy constructor
   



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