Claus Ibsen created CAMEL-27975:
-----------------------------------

             Summary: camel-google-sheets: stream ignores serviceAccountKey 
when clientId is blank, getConfiguration() returns null
                 Key: CAMEL-27975
                 URL: https://issues.apache.org/jira/browse/CAMEL-27975
             Project: Camel
          Issue Type: Bug
          Components: camel-google-sheets
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-google-sheets for 
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31202).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. Blank clientId or clientSecret on the stream ignores serviceAccountKey
{{GoogleSheetsStreamComponent.getClient}} checks clientId and clientSecret only 
for != null, while GoogleSheetsComponent checks them for blank. With an empty 
value (a placeholder that resolves to "", for example) the stream takes the 
OAuth branch, BatchGoogleSheetsClientFactory builds a configuration without 
serviceAccountKey, and the client falls back to Application Default Credentials.
Proposed change: use the same isBlank checks as GoogleSheetsComponent.

h4. 2. getConfiguration() returns null
{{GoogleSheetsComponent}} declares its own configuration field, which hides 
AbstractApiComponent.configuration. getConfiguration() creates the 
configuration in its own field but returns super.getConfiguration(), which is 
null when no configuration was set, so component.getConfiguration().setX(...) 
throws a NullPointerException. The generated configurer is not affected, as it 
calls setConfiguration first.
Proposed change: create the configuration with super.setConfiguration(new 
GoogleSheetsConfiguration()), and drop the hiding field.

h4. 3. Smaller issues
The pom has no substitution for BatchClearValuesByDataFilterRequest, so 
data/batchClearByDataFilter has a parameter named content. google-sheets-stream 
splits range on every comma, so an A1 range whose quoted sheet name contains a 
comma is split wrongly, and maxResults is applied on the client after the whole 
range is fetched. The description of the google-sheets:application-x-struct 
data type has a "JSon" typo.


_Claude Code on behalf of davsclaus_



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

Reply via email to