davsclaus opened a new pull request, #24807:
URL: https://github.com/apache/camel/pull/24807
## Summary
_Claude Code on behalf of davsclaus_
Fixes two related bugs in `FtpOperations` where the `streamDownload=true`
path never checks the FTP client's success indicators, causing silent data loss:
- **`retrieveFileToStreamInBody`**: `FTPClient.retrieveFileStream()` returns
`null` when the server refuses RETR (550/450/425), but the code unconditionally
set `result = true`. The consumer then routes the exchange with a null body and
the process strategy commits — moving or deleting the remote file that was
never downloaded. Fixed by setting `result = is != null` and only populating
the body/header when the stream is available.
- **`releaseRetrievedFileResources`**: `FTPClient.completePendingCommand()`
returns `false` when the transfer did not complete (server sent 426/451), but
the return value was discarded. A truncated stream would be silently accepted
and the commit would still run. Fixed by checking the return value and throwing
`GenericFileOperationFailedException` on failure.
These fixes also re-enable `ignoreFileNotFoundOrPermissionError` for
streamDownload mode — it was previously dead code because `retrieved` was
always `true`.
## Test plan
- [x] New unit test `FtpOperationsStreamDownloadTest` with 5 test cases:
- `testRetrieveFileStreamReturnsNullOnServerError` — verifies
`retrieveFile` returns `false` when server refuses RETR
- `testRetrieveFileStreamSuccessReturnsTrue` — verifies normal success
path still works
- `testReleaseResourcesThrowsOnFailedCompletion` — verifies exception on
failed `completePendingCommand`
- `testReleaseResourcesSucceedsOnCompletedTransfer` — verifies normal
release path
- `testReleaseResourcesSkipsWhenNoStream` — verifies no-op when no stream
header present
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]