You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/08/26 05:16:45 UTC
[camel] branch camel-3.4.x updated: CAMEL-15460: Reverted some
parts of FTP reconnect handle pending commands as it breaks all tests.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.4.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.4.x by this push:
new 89c0af4 CAMEL-15460: Reverted some parts of FTP reconnect handle pending commands as it breaks all tests.
89c0af4 is described below
commit 89c0af4ad4a58ca0a0b6c85b536282d17a4e81dc
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Aug 26 07:15:46 2020 +0200
CAMEL-15460: Reverted some parts of FTP reconnect handle pending commands as it breaks all tests.
---
.../org/apache/camel/component/file/remote/FtpOperations.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
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 d549316..62b4c4a 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
@@ -344,6 +344,7 @@ public class FtpOperations implements RemoteFileOperations<FTPFile> {
public boolean renameFile(String from, String to) throws GenericFileOperationFailedException {
log.debug("Renaming file: {} to: {}", from, to);
try {
+ reconnectIfNecessary(null);
return client.rename(from, to);
} catch (IOException e) {
throw new GenericFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
@@ -989,13 +990,15 @@ public class FtpOperations implements RemoteFileOperations<FTPFile> {
}
private void reconnectIfNecessary(Exchange exchange) throws GenericFileOperationFailedException {
- boolean reconnectRequired = false;
+ boolean reconnectRequired;
try {
- client.completePendingCommand();
- if (!isConnected() || !sendNoop()) {
+ boolean connected = isConnected();
+ if (connected && !sendNoop()) {
reconnectRequired = true;
+ } else {
+ reconnectRequired = !connected;
}
- } catch (IOException | GenericFileOperationFailedException e) {
+ } catch (GenericFileOperationFailedException e) {
// Ignore Exception and reconnect the client
reconnectRequired = true;
}