Skip to content

fix(jira): Fix querying issues on jira cloud instance #18513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

avano
Copy link
Contributor

@avano avano commented Jul 1, 2025

Description

After upgrading the jira client to 6.0.2, it stopped working when querying issues on jira cloud instance. In 6.0.2 they created a new client specifically for the jira cloud that seems to work slightly differently:

  1. when using null as the fields, it did not return any fields at all, resulting in:
Caused by: org.codehaus.jettison.json.JSONException: JSONObject["fields"] not found.
	at org.codehaus.jettison.json.JSONObject.get(JSONObject.java:426)
	at org.codehaus.jettison.json.JSONObject.getJSONObject(JSONObject.java:526)
	at com.atlassian.jira.rest.client.internal.json.IssueJsonParser.parse(IssueJsonParser.java:216)
	at com.atlassian.jira.rest.client.internal.json.IssueJsonParser.parse(IssueJsonParser.java:90)
	at com.atlassian.jira.rest.client.internal.json.GenericJsonArrayParser.parse(GenericJsonArrayParser.java:39)
	at com.atlassian.jira.rest.client.internal.json.SearchResultJsonParser.parseIssues(SearchResultJsonParser.java:43)
	at com.atlassian.jira.rest.client.internal.json.EnhancedSearchResultJsonParser.parse(EnhancedSearchResultJsonParser.java:14)
	at com.atlassian.jira.rest.client.internal.json.EnhancedSearchResultJsonParser.parse(EnhancedSearchResultJsonParser.java:9)
	at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$1.handle(AbstractAsynchronousRestClient.java:153)
	at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$3.apply(AbstractAsynchronousRestClient.java:202)
	... 15 more
  1. searchResult.getTotal() is not available when running against jira cloud:
2025-07-01 13:09:51,878 WARN  [org.apa.cam.com.jir.con.NewIssuesConsumer] (Camel (camel-1) thread #1 - jira://newIssues) Failed polling endpoint: jira://newIssues?jiraUrl=https%3A%2F%2Ffuseqe2025.atlassian.net&jql=project%3DFUQT2&password=xxxxxx&username=xxxxxx. Will try again at next poll. Caused by: [java.lang.UnsupportedOperationException - Total is not available in the Cloud version of the new Search API response. Please use `SearchRestClient.totalCount` instead to fetch the estimated count of the issues for a given JQL.]: java.lang.UnsupportedOperationException: Total is not available in the Cloud version of the new Search API response. Please use `SearchRestClient.totalCount` instead to fetch the estimated count of the issues for a given JQL.
	at com.atlassian.jira.rest.client.api.domain.SearchResult.getTotal(SearchResult.java:80)
	at org.apache.camel.component.jira.consumer.AbstractJiraConsumer.getIssues(AbstractJiraConsumer.java:145)
	at org.apache.camel.component.jira.consumer.AbstractJiraConsumer.getIssues(AbstractJiraConsumer.java:114)
	at org.apache.camel.component.jira.consumer.AbstractJiraConsumer.getIssues(AbstractJiraConsumer.java:110)
	at org.apache.camel.component.jira.consumer.NewIssuesConsumer.getNewIssues(NewIssuesConsumer.java:92)
	at org.apache.camel.component.jira.consumer.NewIssuesConsumer.doPoll(NewIssuesConsumer.java:75)
	at org.apache.camel.component.jira.consumer.AbstractJiraConsumer.poll(AbstractJiraConsumer.java:65)
	at org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:208)
	at org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:119)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

Copy link
Contributor

github-actions bot commented Jul 1, 2025

🌟 Thank you for your contribution to the Apache Camel project! 🌟

🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@davsclaus davsclaus merged commit f9967df into apache:main Jul 2, 2025
3 of 5 checks passed
@davsclaus
Copy link
Contributor

Thanks @avano you are welcome to help with
https://issues.apache.org/jira/browse/CAMEL-17348

... if you have time and can help, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants