You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/09/17 06:01:21 UTC
[camel] branch master updated: CAMEL-15534 - Camel-telegram wrongly
parse chatId from headers
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 3fa9412 CAMEL-15534 - Camel-telegram wrongly parse chatId from headers
3fa9412 is described below
commit 3fa9412c9caccd718438555615efb949a40a108b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Sep 17 08:00:49 2020 +0200
CAMEL-15534 - Camel-telegram wrongly parse chatId from headers
---
.../java/org/apache/camel/component/telegram/TelegramProducer.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramProducer.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramProducer.java
index d8ae65c..cd6c7e3 100644
--- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramProducer.java
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramProducer.java
@@ -20,6 +20,7 @@ import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
import org.apache.camel.component.telegram.model.OutgoingMessage;
import org.apache.camel.support.DefaultAsyncProducer;
+import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,7 +81,9 @@ public class TelegramProducer extends DefaultAsyncProducer {
// Get the chat id from headers
if (chatId == null) {
- chatId = (String) exchange.getIn().getHeader(TelegramConstants.TELEGRAM_CHAT_ID);
+ if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(TelegramConstants.TELEGRAM_CHAT_ID))) {
+ chatId = String.valueOf(exchange.getIn().getHeader(TelegramConstants.TELEGRAM_CHAT_ID));
+ }
}
// If not present in the headers, use the configured value for chat id