You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ju...@apache.org on 2013/05/30 06:26:21 UTC

git commit: kafka-891; NullPointerException in ConsoleConsumer; patched by Colin B.; reviewed by Neha Narkhede and Jun Rao

Updated Branches:
  refs/heads/trunk 731ba9007 -> 3b470f56b


kafka-891; NullPointerException in ConsoleConsumer; patched by Colin B.; reviewed by Neha Narkhede and Jun Rao


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

Branch: refs/heads/trunk
Commit: 3b470f56b479f618b7e90577f9857b4e25b38c1a
Parents: 731ba90
Author: Colin B <la...@gmail.com>
Authored: Wed May 29 21:25:34 2013 -0700
Committer: Jun Rao <ju...@gmail.com>
Committed: Wed May 29 21:25:34 2013 -0700

----------------------------------------------------------------------
 .../scala/kafka/consumer/ConsoleConsumer.scala     |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/3b470f56/core/src/main/scala/kafka/consumer/ConsoleConsumer.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/consumer/ConsoleConsumer.scala b/core/src/main/scala/kafka/consumer/ConsoleConsumer.scala
index d6c4a51..9b566b9 100644
--- a/core/src/main/scala/kafka/consumer/ConsoleConsumer.scala
+++ b/core/src/main/scala/kafka/consumer/ConsoleConsumer.scala
@@ -282,10 +282,10 @@ class DefaultMessageFormatter extends MessageFormatter {
   
   def writeTo(key: Array[Byte], value: Array[Byte], output: PrintStream) {
     if(printKey) {
-      output.write(key)
+      output.write(if (key == null) "null".getBytes() else key)
       output.write(keySeparator)
     }
-    output.write(value)
+    output.write(if (value == null) "null".getBytes() else value)
     output.write(lineSeparator)
   }
 }