[
https://issues.apache.org/jira/browse/CAMEL-26074?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-26074 started by Claus Ibsen.
-------------------------------------------
> camel-aws2-textract - a FeatureTypes header of Strings fails, and the start
> operations give the job id only in the response
> ---------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26074
> URL: https://issues.apache.org/jira/browse/CAMEL-26074
> Project: Camel
> Issue Type: Bug
> Components: camel-aws2
> Affects Versions: 4.18.0, 4.22.0, 4.23.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of aws2-textract (CAMEL-24961).
> h4. 1. A FeatureTypes header of Strings fails with a ClassCastException
> analyzeDocument and startDocumentAnalysis pass the
> {{CamelAwsTextractFeatureTypes}} header to the request as a
> {{List<FeatureType>}} ({{Textract2Producer}}, main ed3d719b379c, lines
> 172-174 and 284-286). A List of Strings, as a YAML route gives, fails in the
> AWS SDK with {{ClassCastException: class java.lang.String cannot be cast to
> class ...FeatureType}}. Checked on 4.24.0-SNAPSHOT with {{camel run}} against
> the AWS emulator of {{camel infra run aws}}.
> *Proposed change*: accept Strings too, with {{FeatureType.fromValue}}.
> h4. 2. The start operations give the job id only in the response
> startDocumentTextDetection, startDocumentAnalysis and startExpenseAnalysis
> set no header, and the get operations read the job id from
> {{CamelAwsTextractJobId}}, or else from the body as text (lines 358-365,
> 409-416 and 460-467). So a start step followed by a get step sends the
> toString() of the start response as the job id. Checked on 4.24.0-SNAPSHOT
> with {{camel run}} against the AWS emulator of {{camel infra run aws}}:
> {{InvalidJobIdException}}; with the header set from {{$\{body.jobId\}}} the
> get works. The catalog describes {{CamelAwsTextractJobId}} as "The job ID for
> async operations (StartDocumentTextDetection, StartDocumentAnalysis)".
> *Proposed change*: set the {{CamelAwsTextractJobId}} header from the start
> response.
> h4. 3. The S3 options win over the headers
> The s3Bucket and s3Object options are read first, and the headers only when
> an option is not set (lines 493-501), the reverse of the other AWS
> components; when only one of bucket and object is known, the body is used as
> the document (line 503). Checked on 4.24.0-SNAPSHOT with {{camel run}}
> against the AWS emulator of {{camel infra run aws}}: the bucket header alone
> gave {{InvalidPayloadException}} for a Map body.
> *Proposed change*: say so in the docs, or read the headers first.
> h4. Also read in the code, not run
> * The page names an {{amazonTextractClient}}; the option is
> {{textractClient}}.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)