Claus Ibsen created CAMEL-26100:
-----------------------------------

             Summary: camel-aws2-athena - a second startQueryExecution takes 
the result file of the first as its output location
                 Key: CAMEL-26100
                 URL: https://issues.apache.org/jira/browse/CAMEL-26100
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2
    Affects Versions: 4.18.0, 4.22.0, 4.23.0
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of aws2-athena (CAMEL-24961).

h4. 1. A second startQueryExecution takes the result file of the first as its 
output location

startQueryExecution reads the output location from the 
{{CamelAwsAthenaOutputLocation}} header before the outputLocation option 
({{Athena2Producer}}, main ed3d719b379c, line 387), and getQueryExecution, 
getQueryResults with S3Pointer and startQueryExecution with waitTimeout set 
that header to the result file of their query (lines 106-107, 142-143 and 
223-224). Checked on 4.24.0-SNAPSHOT with {{camel run}} against a fake of the 
AWS API that logs the requests it gets: a second startQueryExecution in the 
same route, on an endpoint with {{outputLocation=s3://athena-out/r/}}, sent 
{{"OutputLocation":"s3://athena-out/r/q-1.csv"}}, so its results go under the 
result file of the first query. {{CamelAwsAthenaNextToken}} is shared the same 
way: listQueryExecutions sets it (line 192) and getQueryResults reads it (line 
315).

*Proposed change*: do not take the outputs of an earlier step as inputs, or 
document that the headers must be removed in between.

h4. Also read in the code, not run

* The output location of an answer is read without a null check (lines 106-107, 
140-143 and 224): an answer without a ResultConfiguration, as with managed 
query results, fails with a NullPointerException.
* getQueryResults with S3Pointer gives the location without checking that the 
query has succeeded.

_Claude Code on behalf of davsclaus_



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

Reply via email to