[
https://issues.apache.org/jira/browse/CAMEL-27971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27971:
--------------------------------
Description:
Found while improving the option descriptions of camel-zendesk for CAMEL-23832
(commit
https://github.com/apache/camel/commit/a43fa856bf61a24517ac0d3fbc25e0e83b77792d,
pull request https://github.com/apache/camel/pull/31200).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. The component token option is dropped
{{ZendeskComponent.createEndpoint}} copies serverUrl, username, password and
oauthToken from the component to the endpoint configuration, but not token. So
camel.component.zendesk.token is ignored and the client is built with username
and no token or password, which fails at the first call. Checked with a scratch
test (getToken() is null after component.setToken("t")). The Usage example on
the doc page uses exactly camel.component.zendesk.username and .token.
Proposed change: if (endpointConfiguration.getToken() == null)
endpointConfiguration.setToken(token).
h4. 2. The shared zendesk client is never used
{{ZendeskEndpoint.getZendesk}} only uses component.getZendesk() when
getConfiguration().equals(component.getConfiguration()); equals also compares
methodName, which the endpoint always has and the component configuration does
not, and equals(null) is false when no component configuration is set. Checked
with a scratch test in both cases. The client that ZendeskComponent.doStart
creates is never used, but is still created and closed.
Proposed change: use component.getZendesk() when it is set (or leave methodName
out of the comparison), and create the component client only when an endpoint
needs it.
h4. 3. Smaller issues
When several credentials are set, Builder.setToken, setOauthToken and
setPassword each clear the earlier ones, so password wins, then oauthToken,
then token, without an error (the descriptions now say so). serverUrl is not
marked required, but without it Zendesk.Builder throws a NullPointerException
(url.endsWith) when the endpoint starts.
_Claude Code on behalf of davsclaus_
was:
Found while improving the option descriptions of camel-zendesk for CAMEL-23832
(pull request https://github.com/apache/camel/pull/31200).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. The component token option is dropped
{{ZendeskComponent.createEndpoint}} copies serverUrl, username, password and
oauthToken from the component to the endpoint configuration, but not token. So
camel.component.zendesk.token is ignored and the client is built with username
and no token or password, which fails at the first call. Checked with a scratch
test (getToken() is null after component.setToken("t")). The Usage example on
the doc page uses exactly camel.component.zendesk.username and .token.
Proposed change: if (endpointConfiguration.getToken() == null)
endpointConfiguration.setToken(token).
h4. 2. The shared zendesk client is never used
{{ZendeskEndpoint.getZendesk}} only uses component.getZendesk() when
getConfiguration().equals(component.getConfiguration()); equals also compares
methodName, which the endpoint always has and the component configuration does
not, and equals(null) is false when no component configuration is set. Checked
with a scratch test in both cases. The client that ZendeskComponent.doStart
creates is never used, but is still created and closed.
Proposed change: use component.getZendesk() when it is set (or leave methodName
out of the comparison), and create the component client only when an endpoint
needs it.
h4. 3. Smaller issues
When several credentials are set, Builder.setToken, setOauthToken and
setPassword each clear the earlier ones, so password wins, then oauthToken,
then token, without an error (the descriptions now say so). serverUrl is not
marked required, but without it Zendesk.Builder throws a NullPointerException
(url.endsWith) when the endpoint starts.
_Claude Code on behalf of davsclaus_
> camel-zendesk: component token option is not passed to the endpoint, shared
> zendesk client never used
> -----------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27971
> URL: https://issues.apache.org/jira/browse/CAMEL-27971
> Project: Camel
> Issue Type: Bug
> Components: camel-zendesk
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-zendesk for
> CAMEL-23832 (commit
> https://github.com/apache/camel/commit/a43fa856bf61a24517ac0d3fbc25e0e83b77792d,
> pull request https://github.com/apache/camel/pull/31200).
> These are separate problems of the component; the descriptions change only
> documents the current behavior.
> h4. 1. The component token option is dropped
> {{ZendeskComponent.createEndpoint}} copies serverUrl, username, password and
> oauthToken from the component to the endpoint configuration, but not token.
> So camel.component.zendesk.token is ignored and the client is built with
> username and no token or password, which fails at the first call. Checked
> with a scratch test (getToken() is null after component.setToken("t")). The
> Usage example on the doc page uses exactly camel.component.zendesk.username
> and .token.
> Proposed change: if (endpointConfiguration.getToken() == null)
> endpointConfiguration.setToken(token).
> h4. 2. The shared zendesk client is never used
> {{ZendeskEndpoint.getZendesk}} only uses component.getZendesk() when
> getConfiguration().equals(component.getConfiguration()); equals also compares
> methodName, which the endpoint always has and the component configuration
> does not, and equals(null) is false when no component configuration is set.
> Checked with a scratch test in both cases. The client that
> ZendeskComponent.doStart creates is never used, but is still created and
> closed.
> Proposed change: use component.getZendesk() when it is set (or leave
> methodName out of the comparison), and create the component client only when
> an endpoint needs it.
> h4. 3. Smaller issues
> When several credentials are set, Builder.setToken, setOauthToken and
> setPassword each clear the earlier ones, so password wins, then oauthToken,
> then token, without an error (the descriptions now say so). serverUrl is not
> marked required, but without it Zendesk.Builder throws a NullPointerException
> (url.endsWith) when the endpoint starts.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)