Skip to content

Commit

Permalink
BytesMessage.setObject() now works correctly with read-only ByteBuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Apr 17, 2024
1 parent 96efee8 commit 60d4545
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/org/jgroups/BytesMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ public BytesMessage setObject(Object obj) {
return setArray((ByteArray)obj);
if(obj instanceof ByteBuffer) {
ByteBuffer bb=(ByteBuffer)obj;
if(bb.isDirect())
return (BytesMessage)setArray(Util.bufferToArray(bb));
else
if(bb.hasArray())
return setArray(bb.array(), bb.arrayOffset()+bb.position(), bb.remaining());
else
return (BytesMessage)setArray(Util.bufferToArray(bb));
}
try {
ByteArray tmp=Util.objectToBuffer(obj);
Expand Down

0 comments on commit 60d4545

Please sign in to comment.