[
https://issues.apache.org/jira/browse/CAMEL-25932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen reassigned CAMEL-25932:
-----------------------------------
Assignee: Claus Ibsen
> camel-docling - a stream body fails, though the documentation lists
> InputStream as an input
> -------------------------------------------------------------------------------------------
>
> Key: CAMEL-25932
> URL: https://issues.apache.org/jira/browse/CAMEL-25932
> Project: Camel
> Issue Type: Bug
> Components: camel-docling
> Affects Versions: 4.18.0, 4.22.0, 4.23.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> The documentation of the component lists {{InputStream}} among the bodies it
> converts ("{{InputStream}} - Input stream containing document data", and
> "Typed bodies - {{File}}, {{byte[]}}, {{InputStream}}, ...").
> {{DoclingProducer.getInputPath}} takes a String, a {{byte[]}} and a {{File}}
> (also inside a {{WrappedFile}}), and throws for any other body
> ({{DoclingProducer.java:1695-1739}} on main). So a stream fails:
> {code:yaml}
> - route:
> from:
> uri: timer:stream
> parameters:
> repeatCount: 1
> steps:
> - setBody:
> constant: "# Hello"
> - convertBodyTo:
> type: java.io.InputStream
> - to: docling:CONVERT_TO_MARKDOWN
> {code}
> {noformat}
> org.apache.camel.InvalidPayloadException: No body available of type:
> java.lang.String but has type:
> org.apache.camel.converter.stream.ByteArrayInputStreamCache
> {noformat}
> With {{convertBodyTo: byte[]}} instead, the body is taken. Checked on
> 4.24.0-SNAPSHOT. It is so since the component was added (CAMEL-22433, 4.15.0).
> A stream is the body of several components that a document comes from:
> platform-http with the Vert.x engine, the http producer for a response over
> 8192 bytes, ftp and sftp with {{streamDownload}}, and the stream cache that
> stream caching makes of a stream. Each such route needs {{convertBodyTo:
> byte[]}} before docling.
> *Proposed change*: write a stream to the temp file, as a {{byte[]}} is,
> within {{maxFileSize}}, and reset a stream cache after reading it.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)