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 2024/09/11 12:48:57 UTC
(camel) 01/01: CAMEL-21201: camel-ftp - Enrich exception with FTP client error codes if failing to upload file
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch ftp
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 443763372fbb41f6c0e512bd90d09830c42adcaf
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Sep 11 14:48:36 2024 +0200
CAMEL-21201: camel-ftp - Enrich exception with FTP client error codes if failing to upload file
---
.../org/apache/camel/component/file/remote/FtpOperations.java | 8 ++++++++
1 file changed, 8 insertions(+)
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 43a29d10e43..8c827aa5ef4 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
@@ -710,6 +710,14 @@ public class FtpOperations implements RemoteFileOperations<FTPFile> {
clientActivityListener.onUploadComplete(endpoint.getConfiguration().remoteServerInformation(), name);
}
+ if (!answer) {
+ Integer code = exchange.getIn().getHeader(FtpConstants.FTP_REPLY_CODE, Integer.class);
+ String status = exchange.getIn().getHeader(FtpConstants.FTP_REPLY_STRING, String.class);
+ if (code != null && status != null) {
+ throw new GenericFileOperationFailedException(code, status, "Error writing file [" + targetName + "]");
+ }
+ }
+
return answer;
}