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/12/14 09:04:53 UTC

[camel-kafka-connector] 12/15: Ensure the I/O exception is logged if thrown in the SSH transformation

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch camel-master
in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git

commit d52b9f8fbd34d53640403b212be51f9b21e021c5
Author: Otavio Rodolfo Piske <op...@redhat.com>
AuthorDate: Fri Dec 11 17:54:04 2020 +0100

    Ensure the I/O exception is logged if thrown in the SSH transformation
---
 .../apache/camel/kafkaconnector/ssh/transformers/SshTransforms.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/connectors/camel-ssh-kafka-connector/src/main/java/org/apache/camel/kafkaconnector/ssh/transformers/SshTransforms.java b/connectors/camel-ssh-kafka-connector/src/main/java/org/apache/camel/kafkaconnector/ssh/transformers/SshTransforms.java
index bb41a9a..a713c0c 100644
--- a/connectors/camel-ssh-kafka-connector/src/main/java/org/apache/camel/kafkaconnector/ssh/transformers/SshTransforms.java
+++ b/connectors/camel-ssh-kafka-connector/src/main/java/org/apache/camel/kafkaconnector/ssh/transformers/SshTransforms.java
@@ -42,12 +42,13 @@ public class SshTransforms<R extends ConnectRecord<R>> implements Transformation
 
         if (value instanceof ByteArrayInputStream) {
             LOG.debug("Converting record from Ssh Body Result to text");
-            ByteArrayInputStream message = (ByteArrayInputStream)r.value();
+            ByteArrayInputStream message = (ByteArrayInputStream) value;
             String m = null;
             try {
                 m = IOUtils.toString(message, Charset.defaultCharset());
             } catch (IOException e) {
-                e.printStackTrace();
+                LOG.error("Input/output error while transforming the SSH value of type {}: {}", value.getClass(),
+                        e.getMessage(), e);
             }
 
             return r.newRecord(r.topic(), r.kafkaPartition(), null, r.key(), SchemaHelper.buildSchemaBuilderForType(m), m, r.timestamp());