sijie commented on a change in pull request #5123: Modify the schema decode method can decode ByteBuf URL: https://github.com/apache/pulsar/pull/5123#discussion_r322404253
########## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/ByteBufferSchema.java ########## @@ -68,6 +77,22 @@ public ByteBuffer decode(byte[] data) { } } + @Override + public ByteBuffer decode(ByteBuf byteBuf) { + if (null == byteBuf) { + return null; + } else { + int size = byteBuf.readableBytes(); Review comment: since we are returning a `ByteBuffer` back to the user, we shouldn't use a shared byte[]. You have to copy the bytes from ByteBuf and create ByteBuffer from the copied bytes. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services