tabish121 commented on code in PR #24:
URL: https://github.com/apache/qpid-protonj2/pull/24#discussion_r4197377940
##########
protonj2/src/test/java/org/apache/qpid/protonj2/buffer/impl/ProtonCompositeBufferImplTest.java:
##########
@@ -1814,6 +1814,38 @@ private void
doTestReadThenCopyDataFromCompositeWithMultipleAppendedElements(boo
}
}
+ @Test
+ public void
testCopyRangeContainedWithinNonFirstChunkDoesNotThrowIndexOutOfBounds() {
+ try (ProtonBufferAllocator allocator = createProtonDefaultAllocator();
+ ProtonCompositeBuffer composite = allocator.composite()) {
+
+ final byte[] chunk0 = new byte[20];
+ final byte[] chunk1 = new byte[10];
+ final byte[] chunk2 = new byte[10];
+
+ for (int i = 0; i < chunk1.length; ++i) {
+ chunk1[i] = (byte) (100 + i);
+ }
+
+ composite.append(allocator.copy(chunk0));
+ composite.append(allocator.copy(chunk1));
+ composite.append(allocator.copy(chunk2));
+
+ // The requested range lies entirely within the second (non-first)
Review Comment:
This comment doesn't really provide helpful future context and should be
removed or reworked to not talk about a specific fix.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]