[
https://issues.apache.org/jira/browse/CAMEL-24563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109385#comment-18109385
]
mayur mohan commented on CAMEL-24563:
-------------------------------------
Fix implemented in PR https://github.com/apache/camel/pull/25881
Adds WARN log in GenericFileConverter.convertTo() when RemoteFile body is null,
with filename and configuration guidance. Full camel-file test suite passes
with JDK 21.
_Claude Code on behalf of mayurbm_
> camel-file: add diagnostic WARN log in GenericFileConverter when RemoteFile
> body is null
> ----------------------------------------------------------------------------------------
>
> Key: CAMEL-24563
> URL: https://issues.apache.org/jira/browse/CAMEL-24563
> Project: Camel
> Issue Type: Improvement
> Components: camel-ftp
> Reporter: mayur mohan
> Priority: Minor
>
> When a RemoteFile consumer processes a file and stream caching is enabled,
> the type converter attempts to convert RemoteFile -> StreamCache via
> GenericFileConverter. If the RemoteFile body has not been loaded (null), the
> conversion silently returns null with no diagnostic information, making it
> impossible for operators to understand why stream caching was skipped.
> *Stack trace (Camel 3.14.x where this caused NPE):*
> {noformat}
> org.apache.camel.StreamCacheException: Error during type conversion from type:
> org.apache.camel.component.file.remote.RemoteFile to the required type:
> org.apache.camel.StreamCache
> with value RemoteFile[CPP_B2BUnits_196498_20260829_094325.xml]
> due to TypeConversionException: ... due to java.lang.NullPointerException:
> null
> at CamelInternalProcessor$StreamCachingAdvice.before
> at GenericFileConsumer.processExchange
> Caused by: java.lang.NullPointerException
> {noformat}
> *Root cause:* GenericFile.getBody() returns null when the remote file content
> was not retrieved before stream caching attempted. In Camel 4, this no longer
> throws NPE (the null guard was added), but the conversion still silently
> returns null without any log message, leaving operators with no diagnostic
> information.
> *Fix:* Add a WARN log in GenericFileConverter.convertTo() when the file body
> is null, including the filename and guidance on how to fix the configuration
> (localWorkDirectory, streamDownload).
> This is a diagnostic/observability improvement — not a behavior change.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)