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

Claus Ibsen reassigned CAMEL-26076:
-----------------------------------

    Assignee: Claus Ibsen

> camel-aws2-rekognition - no operation fails with a NullPointerException, and 
> a DetectionAttributes header of Strings fails
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26076
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26076
>             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-rekognition (CAMEL-24961).
> h4. 1. No operation fails with a NullPointerException
> The operation option is required, which nothing checks when the route runs, 
> and has no default; with no {{CamelAwsRekognitionOperation}} header, {{switch 
> (determineOperation(exchange))}} ({{Rekognition2Producer}}, main 
> ed3d719b379c, line 121) fails with a NullPointerException. Checked on 
> 4.24.0-SNAPSHOT with {{camel run}} against the AWS emulator of {{camel infra 
> run aws}}.
> *Proposed change*: fail with a message that says to set the operation option 
> or header.
> h4. 2. A DetectionAttributes header of Strings fails with a ClassCastException
> The catalog says {{CamelAwsRekognitionDetectionAttributes}} is a 
> {{Collection<String>}} ({{Rekognition2Constants}}, lines 119-120), but 
> indexFaces passes it to {{detectionAttributes(Collection<Attribute>)}} (lines 
> 883-886), so Strings fail in the AWS SDK. Checked on 4.24.0-SNAPSHOT with 
> {{camel run}} against the AWS emulator of {{camel infra run aws}}: 
> {{['ALL']}} gives {{ClassCastException: class java.lang.String cannot be cast 
> to class ...Attribute}}. {{CamelAwsRekognitionFacialAttributes}} is passed 
> the same way (lines 533-535), and its javaType reads 
> {{List<oftware.amazon.awssdk.services.rekognition.model.Attribute>}} (line 
> 59).
> *Proposed change*: accept Strings, with {{detectionAttributesWithStrings}} 
> and {{attributesWithStrings}}, and fix the javaType.
> h4. 3. The docs
> * The operation option is described as "It can be listFunctions, getFunction, 
> createFunction, deleteFunction or invokeFunction" 
> ({{Rekognition2Configuration}}, line 133), the operations of Lambda.
> * {{CamelAwsRekognitionClientRequestToken}} is described as "The ID of the 
> User" ({{Rekognition2Constants}}, line 40).
> * The page does not say where the image comes from: an {{Image}} of the AWS 
> SDK in the {{CamelAwsRekognitionImage}} header, or the source and target 
> image headers for compareFaces. A byte array in the header is not used: 
> {{InvalidParameterException: Image is a required field}} (checked against the 
> AWS emulator), as is an image in the body.
> * The createCollection example sets no collection id.
> h4. Also read in the code, not run
> * {{Rekognition2ProducerTest}} sends compareFaces with 
> {{CamelAwsRekognitionImage}} and the target image (lines 68-69), not the 
> source image; the mock does not notice.
> _Claude Code on behalf of davsclaus_



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

Reply via email to