This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 1cd28729a3 GH-41717: [Java][Vector] fix issue with ByteBuffer rewind 
in MessageSerializer (#41718)
1cd28729a3 is described below

commit 1cd28729a34a0e761c7dba2612e7f9ec6f4ea31c
Author: PJ Fanning <[email protected]>
AuthorDate: Mon May 20 23:56:48 2024 +0100

    GH-41717: [Java][Vector] fix issue with ByteBuffer rewind in 
MessageSerializer (#41718)
    
    
    
    ### Rationale for this change
    
    ### What changes are included in this PR?
    
    #41717 describes issue and change
    
    ### Are these changes tested?
    
    CI build
    
    ### Are there any user-facing changes?
    
    * GitHub Issue: #41717
    
    Authored-by: PJ Fanning <[email protected]>
    Signed-off-by: David Li <[email protected]>
---
 .../java/org/apache/arrow/vector/ipc/message/MessageSerializer.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/MessageSerializer.java
 
b/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/MessageSerializer.java
index 9deb42c498..099103cd17 100644
--- 
a/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/MessageSerializer.java
+++ 
b/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/MessageSerializer.java
@@ -701,7 +701,8 @@ public class MessageSerializer {
           throw new IOException(
               "Unexpected end of stream trying to read message.");
         }
-        messageBuffer.rewind();
+        // see https://github.com/apache/arrow/issues/41717 for reason why we 
cast to java.nio.Buffer
+        ByteBuffer rewindBuffer = (ByteBuffer) ((java.nio.Buffer) 
messageBuffer).rewind();
 
         // Load the message.
         Message message = Message.getRootAsMessage(messageBuffer);

Reply via email to