[
https://issues.apache.org/jira/browse/CAMEL-27648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27648:
--------------------------------
Fix Version/s: 4.25.0
(was: 4.24.0)
> camel-jira: newIssues context path and lost issues, watchedFields spaces, jql
> not required
> ------------------------------------------------------------------------------------------
>
> Key: CAMEL-27648
> URL: https://issues.apache.org/jira/browse/CAMEL-27648
> Project: Camel
> Issue Type: Bug
> Components: camel-jira
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-jira for CAMEL-23832
> (commit
> https://github.com/apache/camel/commit/7839a66d97744d2d8d8742bac804861addec1cb3).
> These are separate problems of the component; the descriptions commit only
> documents the current behavior.
> h4. 1. newIssues ignores the context path of jiraUrl for the user lookup
> {{NewIssuesConsumer.getUserTimeZone()}} builds the URI with
> {{URI.create(jiraUrl).resolve("rest/api/latest/myself")}}. For a Jira under a
> context path written without a trailing slash, such as
> {{https://example.com/jira}}, this gives
> {{https://example.com/rest/api/latest/myself}}, while the other requests of
> jira-rest-java-client keep the context path. The lookup runs in {{doStart()}}
> outside the try block, so the newIssues consumer fails to start.
> Proposed change: append the path to the base URI (for example with a trailing
> slash added first) instead of resolving it.
> h4. 2. watchedFields with spaces makes every watchUpdates poll fail
> {{WatchUpdatesConsumer}} splits {{watchedFields}} on {{,}} without trimming.
> With {{Status, Priority}}, {{hasFieldChanged()}} calls
> {{Issue.class.getDeclaredMethod("get Priority")}}, which throws
> {{NoSuchMethodException}} in every poll.
> Proposed change: trim each name and skip empty ones; fail at startup with a
> clear message for a name that is not a getter of {{Issue}}.
> h4. 3. newIssues can lose issues after a start with no matching issue
> When the lookup in {{NewIssuesConsumer.doStart()}} succeeds but finds no
> issue, {{getNewIssues()}} takes the {{else}} branch:
> {{getIssues(getEndpoint().getJql())}}, limited to {{maxResults}} and without
> {{ORDER BY created DESC}}. It then takes {{issues.peek()}} as the latest
> issue, and the next polls ask only for issues created after it. If more than
> {{maxResults}} issues were created before that poll, the others are never
> routed (the same problem that CAMEL-25806 fixed for the other branch).
> Without the ORDER BY, the first issue may also not be the newest one (depends
> on the default order of Jira, not tested).
> Proposed change: use {{getAllIssues()}} with {{ORDER BY created DESC}} in
> this branch too.
> h4. 4. No jql: newIssues fails, the other consumers read every issue
> {{jql}} is not required. Without it, {{NewIssuesConsumer}} builds JQL such as
> {{null ORDER BY created DESC}}, which Jira rejects, so the startup lookup and
> every poll fail. {{NewCommentsConsumer}} and {{WatchUpdatesConsumer}} pass
> {{null}} to {{SearchRestClient.searchJql()}}, which sends an empty JQL, so
> they read every issue that the user can see (newComments then loads each of
> them).
> Proposed change: mark {{jql}} as required (or validate it when the consumer
> is created).
> h4. 5. No credential option gives an unclear startup error
> In {{JiraEndpoint.connect()}}, when neither {{username}} nor {{accessToken}}
> is set, the endpoint takes the OAuth branch.
> {{JiraOAuthAuthenticationHandler.getOAuthRsaSigner()}} then calls
> {{Base64.getDecoder().decode(null)}}, and the endpoint fails to start with
> "Error generating the OAuth Authorization RSA Signer" caused by a
> {{NullPointerException}}. The same happens for an OAuth setup that misses
> {{privateKey}}.
> Proposed change: check the options before choosing the authentication, and
> fail with a message that names the missing options (or support anonymous
> access).
> h4. 6. delay has no consumer label
> {{JiraConfiguration.delay}} is only used by the consumer (it is the poll
> delay), but its {{@UriParam}} has no label, so the catalog lists it in the
> {{common}} group.
> Proposed change: add {{label = "consumer"}} (or {{"consumer,scheduler"}} as
> {{ScheduledPollEndpoint}} does).
> h4. 7. Unused header constant and outdated endpoint Javadoc
> {{JiraConstants.ISSUE_COMMENT}} ({{CamelJiraIssueComment}}) has no
> {{@Metadata}} and no code uses it. The Javadoc of {{JiraEndpoint}} after its
> first sentence names {{jira://watchChanges}} (the type is {{watchUpdates}})
> and lists only some of the types.
> Proposed change: remove the constant (or deprecate it) and trim the Javadoc
> to the first sentence.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)