camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/3] git commit: [CAMEL-7306]: key is optional. Avoid NPE
Date Sun, 04 May 2014 08:25:13 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.13.x ad26ff0bd -> 86060eed7
  refs/heads/master a6fb1df10 -> 8b78f5ca9


[CAMEL-7306]: key is optional. Avoid NPE


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

Branch: refs/heads/master
Commit: e317e7b470f03d14fe51b9efcc6d251e869c8224
Parents: cd8da7d
Author: Grzegorz Grzybek <gr.grzybek@gmail.com>
Authored: Tue Apr 8 15:21:54 2014 +0200
Committer: Grzegorz Grzybek <gr.grzybek@gmail.com>
Committed: Tue Apr 8 15:21:54 2014 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/component/kafka/KafkaEndpoint.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e317e7b4/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
index 9bdb100..002d15e 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
@@ -89,7 +89,9 @@ public class KafkaEndpoint extends DefaultEndpoint {
         Message message = new DefaultMessage();
         message.setHeader(KafkaConstants.PARTITION, mm.partition());
         message.setHeader(KafkaConstants.TOPIC, mm.topic());
-        message.setHeader(KafkaConstants.KEY, new String(mm.key()));
+        if (mm.key() != null) {
+            message.setHeader(KafkaConstants.KEY, new String(mm.key()));
+        }
         message.setBody(mm.message());
         exchange.setIn(message);
 


Mime
View raw message