Claus Ibsen created CAMEL-27151:
-----------------------------------

             Summary: camel-ftp - Cannot store file says why, when the body is 
not file content, as camel-file does
                 Key: CAMEL-27151
                 URL: https://issues.apache.org/jira/browse/CAMEL-27151
             Project: Camel
          Issue Type: Improvement
          Components: camel-ftp
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.24.0


When the body cannot be written as a file, for example a List after unmarshal: 
csv, the ftp and sftp producers fail with only:

{code}
WARN  RemoteFileProducer : Writing file failed with: Cannot store file: 
failed/invoices-2026-11-01.csv
{code}

The reason is in the cause, which no log line shows: "No body available of 
type: java.io.InputStream but has type: java.util.ArrayList ... No type 
converter available to convert from type: java.util.ArrayList to the required 
type: java.io.InputStream". The message alone reads like a problem with the 
folder or the permissions, but the folder is fine: the same producer writes a 
text body there.

The file component already says why (CAMEL-25751): "Cannot store file: <file>: 
the body is a ..., which is not file content: <the marshal that writes it>". 
The ftp and sftp components do not.

In the local-model benchmark (connect-sftp-transfer step 2, r30 to r35), an 
onException sends a batch that failed to the folder failed on the server. The 
body is the parsed CSV, a List. 19 of 35 step runs got this message, and 12 of 
them failed. The model changed the folder and the options, because the message 
did not say that the body was the problem. As the failed write is in the 
onException, the batch is rolled back and polled again, so a run logged up to 
123 errors.

Proposal: the ftp and sftp producers read the body as the file component does, 
and "Cannot store file" ends with the reason: what the body is, and how to 
write it.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to