Fix DefaultDataBuffer#getNativeBuffer() to set correct limit#32009
Closed
injae-kim wants to merge 1 commit intospring-projects:mainfrom
Closed
Fix DefaultDataBuffer#getNativeBuffer() to set correct limit#32009injae-kim wants to merge 1 commit intospring-projects:mainfrom
DefaultDataBuffer#getNativeBuffer() to set correct limit#32009injae-kim wants to merge 1 commit intospring-projects:mainfrom
Conversation
injae-kim
commented
Jan 10, 2024
Contributor
Author
There was a problem hiding this comment.
0 1 2 3 4 5 6 7 8 9
^ ^
read write
When readPosition: 7 and writePosition: 10,
Current getNativebuffer return bytebuffer with limit: 3 (readableByteCount(), writePos - readPos)
But I think we should set limit: 10 (writePos) correctly.
Like this commit, maybe we set redableByteCount() as length on bytebuffer's limit by mistake 😅
177104b to
cd85736
Compare
cd85736 to
d357085
Compare
injae-kim
commented
Jan 23, 2024
Comment on lines
+37
to
+38
| @Test // gh-30967 | ||
| void getNativeBuffer() { |
Contributor
Author
poutsma
added a commit
that referenced
this pull request
Feb 20, 2024
…iveBuffer * gh-32009: Polishing external contribution Set correct limit in DefaultDataBuffer::getNativeBuffer
Contributor
|
Thanks for supplying a PR. I decided to change the fix by returning a duplicate with independent position and limit, instead changing these on the buffer itself. This is arguably the way it should have been since 5fc1806. |
Contributor
Author
|
Oh thank you for your additional polishing :) I'm so happy that this is my first contribution(969d0bd) on spring-framework! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes gh-30967
Motivation
DefaultDataBuffer#getNativeBuffersetbyteBuffer#limitasreadableByteCount()incorrectly so fix towritePositionModification
DefaultDataBuffer#getNativeBuffer()to set correct limit aswritePositioninstead ofreadableByteCount()Result
DefaultDataBuffer#getNativeBuffer()return native bytebuffer with correct limit