oscerd opened a new pull request, #26079: URL: https://github.com/apache/camel/pull/26079
## Issue [CAMEL-24612](https://issues.apache.org/jira/browse/CAMEL-24612) Three issues in `LangChain4jAgentConverter`: 1. **Charset** — text content was decoded with `new String(data)` (platform default charset). Combined with `normalizeContentType()` stripping the `charset=` parameter, non-ASCII text was mis-decoded on a non-UTF-8 locale. Decode with `StandardCharsets.UTF_8`. 2. **Content-type normalization** — the `WrappedFile` path of `detectMimeType` returned the raw header value, unlike its `byte[]`/`InputStream` sibling `detectMimeTypeFromHeaders` which wraps every return in `normalizeContentType(...)`. A `WrappedFile` whose content-type header carries parameters (e.g. `application/pdf; charset=...`) failed the exact-match branch in `createContent` and was rejected as "Unsupported MIME type". Normalize the `WrappedFile`-path values too. 3. **Stream leak** — the `InputStream` converter called `readAllBytes()` but never closed the stream. Read it inside a try-with-resources. ## Testing - New tests in `LangChain4jAgentConverterTest`: text bytes are decoded as UTF-8, and the input stream is closed after conversion (the latter verified to fail against the unpatched code). The content-type normalization mirrors the already-tested `byte[]`/`InputStream` path. - `mvn -Psourcecheck validate` green. 🤖 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]
