kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: MINOR: MemoryRecords.sizeInBytes throws NPE when non-writable.
Date Tue, 19 Jan 2016 06:25:42 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk b1d325b3c -> 0a7f2bf33


MINOR: MemoryRecords.sizeInBytes throws NPE when non-writable.

I just noticed that `MemoryRecords.sizeInBytes` throws NPE when MemoryRecords is non-writable.
`compressor` is explicitly set to null when `writable` is false (L56) at the construction
time, for instance when `MemoryRecords.readableRecords` is used.

guozhangwang Could you take a look when you have time?

Author: David Jacot <david.jacot@gmail.com>

Reviewers: Guozhang Wang

Closes #786 from dajac/kafka-npe


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/0a7f2bf3
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/0a7f2bf3
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/0a7f2bf3

Branch: refs/heads/trunk
Commit: 0a7f2bf335e426b12f717ec7f6d51779d56fe59b
Parents: b1d325b
Author: David Jacot <david.jacot@gmail.com>
Authored: Mon Jan 18 22:25:37 2016 -0800
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Mon Jan 18 22:25:37 2016 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/kafka/common/record/MemoryRecords.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/0a7f2bf3/clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java b/clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java
index a5a56e1..971f0a2 100644
--- a/clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java
+++ b/clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java
@@ -145,7 +145,7 @@ public class MemoryRecords implements Records {
         if (writable) {
             return compressor.buffer().position();
         } else {
-            return compressor.buffer().limit();
+            return buffer.limit();
         }
     }
 


Mime
View raw message