[ 
https://issues.apache.org/jira/browse/CAMEL-26007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on CAMEL-26007 started by Claus Ibsen.
-------------------------------------------
> camel-mail - mimeMultipart unmarshal of a body that is not a multipart leaves 
> a closed stream for a file
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26007
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26007
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 4.18.0, 4.22.0, 4.23.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> When the {{Content-Type}} header is not a multipart, or is missing, 
> mimeMultipart unmarshal returns the input stream itself as the body 
> ({{MimeMultipartDataFormat}}, main 56aa5f4970a6, lines 305 and 308). The docs 
> say it leaves such a message alone. Since CAMEL-21293 (4.9.0), 
> {{UnmarshalProcessor}} and {{DataFormat.unmarshal(Exchange, Object)}} close 
> the input stream when unmarshal returns. For a file, and any stream that is 
> not in memory, the body is then a closed stream, and the next step fails with 
> {{java.io.IOException: Stream closed}}. A body in memory survives, as closing 
> it does nothing. Files from the file consumer have no {{Content-Type}} 
> header, so all of them take this path. This is the same pattern as 
> CAMEL-25995 (base64).
> Checked on 4.24.0-SNAPSHOT with {{camel run}}, with a plain text file:
> * a {{java.io.File}} body, then {{unmarshal: mimeMultipart}}: the body is a 
> {{java.io.BufferedInputStream}}, and the next step fails with 
> {{StreamCacheException}} ... {{due to java.io.IOException: Stream closed}};
> * {{from: file}}, then {{unmarshal: mimeMultipart}}: the same.
> *Proposed change*: leave the body as it was when it is not a multipart, as 
> the docs say, instead of returning the stream.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to