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/11 17:35:49 UTC

[camel-kafka-connector] branch master updated (97ddd27 -> 2205e27)

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

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


    from 97ddd27  (chores) Use log markers
     new c773da0  Prevent an NPE in the ssh transformation the unlikely case value is null
     new 2205e27  Ensure the I/O exception is logged if thrown in the SSH transformation

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/kafkaconnector/ssh/transformers/SshTransforms.java     | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)


[camel-kafka-connector] 01/02: Prevent an NPE in the ssh transformation the unlikely case value is null

Posted by ac...@apache.org.
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-kafka-connector.git

commit c773da0ce96703a7f9af18f08c3c8e5db9578992
Author: Otavio Rodolfo Piske <op...@redhat.com>
AuthorDate: Fri Dec 11 17:50:57 2020 +0100

    Prevent an NPE in the ssh transformation the unlikely case value is null
---
 .../apache/camel/kafkaconnector/ssh/transformers/SshTransforms.java   | 4 ++--
 1 file changed, 2 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 8f14538..bb41a9a 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
@@ -40,7 +40,7 @@ public class SshTransforms<R extends ConnectRecord<R>> implements Transformation
     public R apply(R r) {
         Object value = r.value();
 
-        if (r.value() instanceof ByteArrayInputStream) {
+        if (value instanceof ByteArrayInputStream) {
             LOG.debug("Converting record from Ssh Body Result to text");
             ByteArrayInputStream message = (ByteArrayInputStream)r.value();
             String m = null;
@@ -53,7 +53,7 @@ public class SshTransforms<R extends ConnectRecord<R>> implements Transformation
             return r.newRecord(r.topic(), r.kafkaPartition(), null, r.key(), SchemaHelper.buildSchemaBuilderForType(m), m, r.timestamp());
 
         } else {
-            LOG.debug("Unexpected message type: {}", r.value().getClass());
+            LOG.debug("Unexpected message type: {}", value == null ? "null instance" : value.getClass());
 
             return r;
         }


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

Posted by ac...@apache.org.
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-kafka-connector.git

commit 2205e2760cf71ba71a4e17c72bf8fea61a846c85
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());