This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 ca296c2 CAMEL-15460: Reverted some parts of FTP reconnect handle
pending commands as it breaks all tests.
ca296c2 is described below
commit ca296c2f7f06165e050be7edc745759d790c1e47
Author: Claus Ibsen <[email protected]>
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 1d9741a..df92e85 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
@@ -353,6 +353,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);
@@ -1008,13 +1009,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;
}