davsclaus commented on code in PR #25881:
URL: https://github.com/apache/camel/pull/25881#discussion_r3886942826
##########
components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileConverter.java:
##########
@@ -54,6 +54,11 @@ public static Object convertTo(Class<?> type, Exchange
exchange, Object value, T
GenericFile<?> file = (GenericFile<?>) value;
Object body = file.getBody();
if (body == null) {
+ LOG.warn(
+ "Cannot convert GenericFile '{}' to {} because the
file body has not been loaded."
+ + " The remote file content was not retrieved before
stream caching."
+ + " Check your SFTP/FTP consumer configuration
(localWorkDirectory, streamDownload).",
+ file.getFileName(), type.getName());
Review Comment:
This fallback converter is invoked for any `GenericFile -> X` conversion
attempt, not only the `RemoteFile -> StreamCache` case this message describes —
the wording ("before stream caching", SFTP/FTP tuning advice) will mislead
operators hitting a null body via an unrelated conversion path. More
importantly, this is a hot/speculative codepath in the type conversion system
(invoked once per route node per exchange via `StreamCachingAdvice`, since a
failed conversion here isn't memoized), so a WARN here can repeat many times
for a single problematic file rather than surfacing once. Recommend moving any
diagnostic here to the actual stream-caching call site in camel-core (which
knows the specific context) instead of the shared GenericFile fallback
converter, or investigating why the body is unloaded at this point rather than
logging around it.
--
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]