You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2024/01/12 14:46:32 UTC

(camel) 04/06: CAMEL-20297 camel-ftp: do not swallow interrupted exceptions

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

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f2348919e7f1dfaa0d9d14212a90cddbf2df3e02
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jan 12 10:49:28 2024 +0100

    CAMEL-20297 camel-ftp: do not swallow interrupted exceptions
---
 .../main/java/org/apache/camel/component/file/remote/SftpOperations.java | 1 +
 .../file/remote/strategy/SftpChangedExclusiveReadLockStrategy.java       | 1 +
 2 files changed, 2 insertions(+)

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 c03b97b8d16..ae993e7e80f 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
@@ -1197,6 +1197,7 @@ public class SftpOperations implements RemoteFileOperations<SftpRemoteFile> {
             tmp.join(timeout);
             message = "timeout: ";
         } catch (java.lang.InterruptedException eee) {
+            Thread.currentThread().interrupt();
         }
         if (sockp[0] != null && sockp[0].isConnected()) {
             socket = sockp[0];
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpChangedExclusiveReadLockStrategy.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpChangedExclusiveReadLockStrategy.java
index 76564696baa..b21d6aa77d7 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpChangedExclusiveReadLockStrategy.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpChangedExclusiveReadLockStrategy.java
@@ -153,6 +153,7 @@ public class SftpChangedExclusiveReadLockStrategy implements GenericFileExclusiv
             Thread.sleep(checkInterval);
             return false;
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.debug("Sleep interrupted while waiting for exclusive read lock, so breaking out");
             return true;
         }