camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] git commit: [CAMEL-7306]: key is optional. Avoid NPE
Date Sun, 04 May 2014 08:25:15 GMT
[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/86060eed
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/86060eed
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/86060eed

Branch: refs/heads/camel-2.13.x
Commit: 86060eed7ddc95f1415a6383293961da98a6ae44
Parents: ad26ff0
Author: Grzegorz Grzybek <gr.grzybek@gmail.com>
Authored: Tue Apr 8 15:21:54 2014 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun May 4 10:24:57 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/86060eed/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