Claus Ibsen created CAMEL-26231:
-----------------------------------

             Summary: camel-influxdb - a server error in the query result does 
not fail the exchange, and the Map converter mutates the caller's Map
                 Key: CAMEL-26231
                 URL: https://issues.apache.org/jira/browse/CAMEL-26231
             Project: Camel
          Issue Type: Bug
          Components: camel-influxdb
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of influxdb (CAMEL-24961, PR #28398).

h4. 1. A server error in the QueryResult does not fail the exchange

{{InfluxDbProducer.doQuery}} (main 2a465aa4814c, lines 101-103) sets the 
{{QueryResult}} as the body without checking {{hasError()}}. A query on an 
unknown database succeeds with the error inside the result, while a syntax 
error throws. Checked on 4.24.0-SNAPSHOT with InfluxDB 1.8 and 2.7 (docker).

Proposed: fail the exchange when {{resultSet.hasError()}} (or a result has an 
error).

h4. 2. The Map converter mutates the caller's Map

{{CamelInfluxDbConverters}} (lines 42-44) removes 
{{camelInfluxDB.MeasurementName}} from the body Map and puts it back, so an 
immutable Map fails and a shared Map is changed. Read in the code, not run.

Proposed: copy the Map without the measurement key.

h4. 3. The operation is a case-sensitive free String

{{InfluxDbEndpoint}} (line 58) declares {{operation}} as a String, so 
{{operation=QUERY}} is accepted and fails only at the first message with "The 
operation QUERY is not supported" ({{InfluxDbProducer}} line 70). Read in the 
code, not run.

Proposed: declare the option with {{enums = "insert,query,ping"}} and validate 
it at startup (or compare ignoring case).

_Claude Code on behalf of davsclaus_



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

Reply via email to