-
Notifications
You must be signed in to change notification settings - Fork 26
CASSANALYTICS-116 Fix ByteBuffer flip() in StreamBuffer.copyBytes() causing data corruption #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should avoid the changes in the analytics-sidecar-client and the other sidecar-copied subprojects at the best. Those files are supposed to be in sync with Sidecar. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,11 +27,15 @@ | |
| public interface StreamBuffer | ||
| { | ||
| /** | ||
| * Copies bytes from this {@link StreamBuffer} into the {@link ByteBuffer destination} | ||
| * Copies bytes from this {@link StreamBuffer} into the {@link ByteBuffer destination}. | ||
| * <p> | ||
| * This method writes {@code length} bytes starting at the destination buffer's current position | ||
| * and advances the position by {@code length}. The caller is responsible for calling | ||
| * {@link ByteBuffer#flip()} on the destination buffer before reading from it. | ||
| * | ||
|
Comment on lines
+30
to
35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for adding the docs. Let's actually add the docs in |
||
| * @param sourceOffset the offset within the {@link StreamBuffer} to be read; must be non-negative and | ||
| * larger than the buffer length | ||
| * @param destination a {@link ByteBuffer} where the data will be copied | ||
| * @param destination a {@link ByteBuffer} where the data will be copied at its current position | ||
| * @param length the number of bytes to be copied from the {@link StreamBuffer}; must be non-negative and | ||
| * larger than the {@code buffer.length - sourceOffset} | ||
| */ | ||
|
|
@@ -94,7 +98,6 @@ private ByteArrayWrapper(byte[] bytes) | |
| public void copyBytes(int sourceOffset, ByteBuffer destination, int length) | ||
| { | ||
| destination.put(bytes, sourceOffset, length); | ||
| destination.flip(); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the description is no longer accurate. Please update to reflect the actual fix.