mayurbm commented on PR #25881:
URL: https://github.com/apache/camel/pull/25881#issuecomment-5463329312
@davsclaus Thank you for the detailed review — you are right on both counts.
**Changes made:**
1. **Removed the WARN from `GenericFileConverter`** — it is a generic
fallback converter called speculatively for any `GenericFile` conversion, not
just stream caching. The hardcoded stream-caching message was misleading and
risked log flooding.
2. **Moved the WARN to `StreamCachingHelper.tryStreamCache()`** — this is
the dedicated stream-caching call site, invoked exclusively from
`StreamCachingAdvice.before()`. It knows it is specifically attempting stream
caching, making it the correct place for the diagnostic. The log fires only
when `strategy.cache()` returns null AND the body is a `WrappedFile` with a
null embedded body:
```java
} else {
Object body = inMessage.getBody();
if (body instanceof WrappedFile<?> wf && wf.getBody() == null) {
LOG.warn("Stream caching skipped: the body is a WrappedFile ({})
whose content has not been loaded..."
+ " Check your consumer configuration (localWorkDirectory
or streamDownload for FTP/SFTP).",
body.getClass().getSimpleName());
}
}
```
3. **Test moved to `camel-core`** (`GenericFileStreamCachingNullBodyTest`) —
uses an anonymous `WrappedFile` with null body sent through a
stream-caching-enabled route, verifying no NPE is thrown.
Local test results: `camel-base-engine` + `camel-file` full suites pass with
JDK 21.
_Claude Code on behalf of mayurbm_
--
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]