keith-turner commented on code in PR #80:
URL: https://github.com/apache/accumulo-access/pull/80#discussion_r1693249483


##########
src/main/java/org/apache/accumulo/access/BytesWrapper.java:
##########
@@ -118,18 +111,7 @@ public String toString() {
    * a copy of the input buffer
    */
   void set(byte[] data, int offset, int length) {
-    if (offset < 0) {
-      throw new IllegalArgumentException("Offset cannot be negative. length = 
" + offset);
-    }
-    if (length < 0) {
-      throw new IllegalArgumentException("Length cannot be negative. length = 
" + length);
-    }
-    if ((offset + length) > data.length) {
-      throw new IllegalArgumentException(
-          "Sum of offset and length exceeds data length. data.length = " + 
data.length
-              + ", offset = " + offset + ", length = " + length);
-    }
-
+    Objects.checkFromIndexSize(offset, length, data.length);

Review Comment:
   Yeah I spent a bit looking at the arguments passed in to make sure I was 
doing it correctly and making sure I was calling the correct method.  I think 
the upside is that the places where these functions would be used in this 
project and in accumulo are fairly stable and do not change often, so once we 
get it correct it will probably not change for a long time period.



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