You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/22 06:13:00 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #9667: [Compression] Fix ByteBuffer allocate error in the AirliftUtils

codelipenghui commented on a change in pull request #9667:
URL: https://github.com/apache/pulsar/pull/9667#discussion_r580004822



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/compression/AirliftUtils.java
##########
@@ -25,10 +25,10 @@
  */
 public abstract class AirliftUtils {
 
-    static ByteBuffer ensureAirliftSupported(ByteBuffer encodedNio, int uncompressedLength) {
+    static ByteBuffer ensureAirliftSupported(ByteBuffer encodedNio) {
         if (!encodedNio.isDirect() && !encodedNio.hasArray()) {
             // airlift needs a raw ByteArray
-            ByteBuffer copy = ByteBuffer.allocate(uncompressedLength);
+            ByteBuffer copy = ByteBuffer.allocate(encodedNio.capacity());

Review comment:
       Yes, using max is better.




----------------------------------------------------------------
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:
users@infra.apache.org