Marco Carletti created CAMEL-23378:
--------------------------------------

             Summary: 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.20.0, 4.18.2
            Reporter: Marco Carletti


  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)

Reply via email to