You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2024/05/20 22:56:54 UTC

(arrow) branch main updated: GH-41717: [Java][Vector] fix issue with ByteBuffer rewind in MessageSerializer (#41718)

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 <pj...@users.noreply.github.com>
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 <pj...@users.noreply.github.com>
    Signed-off-by: David Li <li...@gmail.com>
---
 .../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);