keith-turner commented on code in PR #4745:
URL: https://github.com/apache/accumulo/pull/4745#discussion_r1687012336


##########
core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java:
##########
@@ -180,4 +180,21 @@ public byte[] toArray() {
   public String toString() {
     return new String(data, offset, length, UTF_8);
   }
+
+  public void setArray(byte[] data, int offset, int length) {
+    if (offset < 0 || offset > data.length || length < 0 || (offset + length) 
> data.length) {
+      throw new IllegalArgumentException(" Bad offset and/or length 
data.length = " + data.length
+          + " offset = " + offset + " length = " + length);
+    }
+    this.data = data;
+    this.offset = offset;
+    this.length = length;
+  }
+
+  public void setLength(int length) {
+    if (length < 0) {
+      throw new IllegalArgumentException(" Bad length = " + length);
+    }
+    this.length = length;
+  }

Review Comment:
   Wondering if we can drop this method, not sure.   Its only called in two 
places, wonder if it would be cleaner to refactor those two places to call 
`setArray` instead of this setLength method.  
   
   If this method is kept then its validation will need to be improved to 
ensure that length makes sense for the current offset and data.length.   Also 
need to add javadoc that states it sets the length if the length is less than 
the length of the current array minus the current offset.  Also the javadoc 
would need to include a `@since 3.1.0` tag.
   



##########
core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java:
##########
@@ -180,4 +180,21 @@ public byte[] toArray() {
   public String toString() {
     return new String(data, offset, length, UTF_8);
   }
+
+  public void setArray(byte[] data, int offset, int length) {

Review Comment:
   This needs javadoc with a `@since 3.1.0` tag.



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