[
https://issues.apache.org/jira/browse/CAMEL-23378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Marco Carletti reassigned CAMEL-23378:
--------------------------------------
Assignee: Marco Carletti
> Block String to InputStream conversion in SpringTypeConverter
> -------------------------------------------------------------
>
> Key: CAMEL-23378
> URL: https://issues.apache.org/jira/browse/CAMEL-23378
> Project: Camel
> Issue Type: Bug
> Affects Versions: 4.18.2, 4.20.0
> Reporter: Marco Carletti
> Assignee: Marco Carletti
> Priority: Critical
>
> When a Camel Spring Boot route writes a String body to a file: endpoint
> with checksumFileAlgorithm enabled, the body is incorrectly converted to a
> FileInputStream by Spring's ObjectToObjectConverter, which treats the String
> content as
> a file path:
>
>
>
>
> ConversionFailedException: Failed to convert from type [java.lang.String]
> to type [java.io.FileInputStream] for value [some file content]
>
>
>
> Caused by: FileNotFoundException: some file content (No such file or
> directory)
>
>
>
>
> This happens because the file component's checksum code path
> (FileOperations.java:321) calls
> exchange.getMessage().getBody(FileInputStream.class). On plain Camel this
> returns null (no matching converter) and falls through to the safe
> InputStream path. On Spring Boot, SpringTypeConverter delegates to Spring's
> GenericConversionService, which finds ObjectToObjectConverter. This converter
> sees the FileInputStream(String) constructor and calls new
> FileInputStream("some
> file content") — interpreting the message body as a file path instead of
> data.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)