Skip to content

Commit

Permalink
Merge pull request #785 from cfredri4/patch-2
Browse files Browse the repository at this point in the history
Fix ReadOnlyBufferException in BytesMessage
  • Loading branch information
belaban committed Apr 17, 2024
2 parents 684e6b2 + 82b5350 commit 7f2499a
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 7f2499a

Please sign in to comment.