dlmarion commented on code in PR #89:
URL: https://github.com/apache/accumulo-access/pull/89#discussion_r2611199565


##########
src/main/java/org/apache/accumulo/access/StringUtils.java:
##########
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.access;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+/**
+ * Utilities for String to byte[] conversion and vice-versa
+ */
+public class StringUtils {

Review Comment:
   Reverted this in e04689e. Modified the tests to have their own methods.



##########
src/main/java/org/apache/accumulo/access/AccessExpressionImpl.java:
##########
@@ -18,40 +18,35 @@
  */
 package org.apache.accumulo.access;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.apache.accumulo.access.ByteUtils.EMPTY_BYTES;
 
+import java.util.Arrays;
 import java.util.concurrent.atomic.AtomicReference;
 
 final class AccessExpressionImpl extends AccessExpression {
 
   private static final long serialVersionUID = 1L;
 
-  public static final AccessExpression EMPTY = new AccessExpressionImpl("");
+  public static final AccessExpression EMPTY = new 
AccessExpressionImpl(EMPTY_BYTES);
 
-  private final String expression;
+  private final byte[] expression;
   private final AtomicReference<ParsedAccessExpression> parseTreeRef = new 
AtomicReference<>();
 
-  AccessExpressionImpl(String expression) {
-    validate(expression);
-    this.expression = expression;
-  }
-
   AccessExpressionImpl(byte[] expression) {
     validate(expression);
-    this.expression = new String(expression, UTF_8);
+    this.expression = Arrays.copyOf(expression, expression.length);
   }
 
   @Override
-  public String getExpression() {
+  public byte[] getExpression() {
     return expression;

Review Comment:
   Implemented in e04689e.



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