You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run my program, I get a warning message with the title. The message also said "Please consider reporting this to the maintainers of org.msgpack.core.buffer.DirectBufferAccess", so I will report it here.
A simple reproduction program (named ReproduceCase.java) is below.
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.msgpack.core.MessagePack;
import org.msgpack.core.MessagePacker;
import org.msgpack.core.MessageUnpacker;
import org.msgpack.core.buffer.ByteBufferInput;
public final class ReproduceCase {
class ByteBufferBackedInput extends ByteBufferInput {
ByteBufferBackedInput(ByteBuffer byteBuffer) {
super(byteBuffer);
}
}
ReproduceCase() {
}
ByteBufferInput encode() throws IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
MessagePacker packer = org.msgpack.core.MessagePack.newDefaultPacker(outputStream);
packer.packLong((long) 123456789);
packer.flush();
byte[] ba = outputStream.toByteArray();
var length = ba.length;
var directByteBuffer = ByteBuffer.allocateDirect(length);
directByteBuffer.put(ba, 0, length);
directByteBuffer.rewind();
return new ByteBufferBackedInput(directByteBuffer);
}
void decode(ByteBufferInput buffer) throws IOException {
var unpacker = org.msgpack.core.MessagePack.newDefaultUnpacker(buffer);
System.out.println(unpacker.unpackLong());
}
public static void main(String[] args) {
try {
var reproduce = new ReproduceCase();
var buffer = reproduce.encode();
reproduce.decode(buffer);
} catch (IOException e) {
System.out.println(e);
}
}
}
The warning message is output when the following line is executed.
var unpacker = org.msgpack.core.MessagePack.newDefaultUnpacker(buffer);
The following is supplementary information.
This happens with both msgpack-core-0.8.24 and 0.9.0.
unpacker.unpackLong() works fine, as you can see when you run the program.
If you used ByteBuffer.allocate(length) instead of ByteBuffer.allocateDirect(length), you will not get that warning. However, that is not a solution for me because my program needs to use direct byte buffer.
The text was updated successfully, but these errors were encountered:
When I run my program, I get a warning message with the title. The message also said "Please consider reporting this to the maintainers of org.msgpack.core.buffer.DirectBufferAccess", so I will report it here.
A simple reproduction program (named ReproduceCase.java) is below.
The warning message is output when the following line is executed.
The following is supplementary information.
The text was updated successfully, but these errors were encountered: