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

davsclaus pushed a commit to branch camel-3.11.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9cfa453cfa0d3a4e5b1654ba5a21e1e4a83b1194
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Thu Jun 24 15:13:44 2021 +0200

    CAMEL-16692: camel-ftp - If writing failed then do not supress exception in 
case we are stopping.
---
 .../component/file/remote/RemoteFileProducer.java   | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
index a415f88..15b81ee 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
@@ -83,20 +83,15 @@ public class RemoteFileProducer<T> extends 
GenericFileProducer<T> {
     @Override
     public void handleFailedWrite(Exchange exchange, Exception exception) 
throws Exception {
         loggedIn = false;
-        if (isStopping() || isStopped()) {
-            // if we are stopping then ignore any exception during a poll
-            LOG.debug("Exception occurred during stopping: {}", 
exception.getMessage());
-        } else {
-            LOG.warn("Writing file failed with: {}", exception.getMessage());
-            try {
-                disconnect();
-            } catch (Exception e) {
-                // ignore exception
-                LOG.debug("Ignored exception during disconnect: {}", 
e.getMessage());
-            }
-            // rethrow the original exception*/
-            throw exception;
+        LOG.warn("Writing file failed with: {}", exception.getMessage());
+        try {
+            disconnect();
+        } catch (Exception e) {
+            // ignore exception
+            LOG.debug("Ignored exception during disconnect: {}", 
e.getMessage());
         }
+        // rethrow the original exception
+        throw exception;
     }
 
     public void disconnect() throws GenericFileOperationFailedException {

Reply via email to