You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pa...@apache.org on 2019/12/22 15:57:10 UTC

[camel] branch master updated: Remove useless type tests identified by lgtm.com.

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

pascalschumacher 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 915cde6  Remove useless type tests identified by lgtm.com.
915cde6 is described below

commit 915cde6f38a5b500cdeed10e11686e07431cdcca
Author: Pascal Schumacher <pa...@gmx.net>
AuthorDate: Sun Dec 22 16:56:56 2019 +0100

    Remove useless type tests identified by lgtm.com.
---
 .../camel/component/file/GenericFilePollingConsumer.java  |  2 +-
 .../apache/camel/component/file/remote/FtpOperations.java | 15 ++++++---------
 .../camel/component/file/remote/SftpOperations.java       |  5 +----
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java
index 828eae0..dffa628 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java
@@ -115,7 +115,7 @@ public class GenericFilePollingConsumer extends EventDrivenPollingConsumer {
         Throwable cause = null;
         int polledMessages = 0;
         PollingConsumerPollStrategy pollStrategy = getConsumer().getPollStrategy();
-        boolean sendEmptyMessageWhenIdle = getConsumer() instanceof ScheduledBatchPollingConsumer && getConsumer().isSendEmptyMessageWhenIdle();
+        boolean sendEmptyMessageWhenIdle = getConsumer().isSendEmptyMessageWhenIdle();
         StopWatch watch = new StopWatch();
 
         while (!done) {
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
index 255b52a..3598535 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
@@ -183,15 +183,12 @@ public class FtpOperations implements RemoteFileOperations<FTPFile> {
         }
 
         // must set soTimeout after connect
-        if (endpoint instanceof FtpEndpoint) {
-            FtpEndpoint<?> ftpEndpoint = endpoint;
-            if (ftpEndpoint.getSoTimeout() > 0) {
-                log.trace("Using SoTimeout={}", ftpEndpoint.getSoTimeout());
-                try {
-                    client.setSoTimeout(ftpEndpoint.getSoTimeout());
-                } catch (IOException e) {
-                    throw new GenericFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-                }
+        if (endpoint.getSoTimeout() > 0) {
+            log.trace("Using SoTimeout={}", endpoint.getSoTimeout());
+            try {
+                client.setSoTimeout(endpoint.getSoTimeout());
+            } catch (IOException e) {
+                throw new GenericFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
             }
         }
 
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
index b461511..8155bc4 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
@@ -1107,10 +1107,7 @@ public class SftpOperations implements RemoteFileOperations<SftpRemoteFile> {
                 return socket;
             } catch (Exception e) {
                 String message = e.toString();
-                if (e instanceof Throwable) {
-                    throw new RuntimeCamelException(message, e);
-                }
-                throw new RuntimeCamelException(message);
+                throw new RuntimeCamelException(message, e);
             }
         }
         final Socket[] sockp = new Socket[1];