allthingssecurity opened a new pull request, #28469:
URL: https://github.com/apache/camel/pull/28469

   # Description
   
   [CAMEL-25943](https://issues.apache.org/jira/browse/CAMEL-25943)
   
   `AbstractJiraConsumer.getIssues` says that `maxResults` is ignored when it 
is 0 or less, but it first used it as the page size (`if (maxResults < 
maxPerQuery) maxPerQuery = maxResults;`). On Jira Server / Data Center the loop 
then asked for a page of 0 issues at `startAt=0`, got no issue and the total, 
and continued with `start += 0`. None of the exit conditions held while the 
search found an issue, so the consumer repeated the same search request forever:
   
   - `watchUpdates` and `newComments` read the issues in `doStart`, so the 
route never finished starting and the CamelContext startup hung;
   - `newIssues` hung in its first poll when the JQL found no issue at startup 
(no latest issue yet);
   - a negative `maxResults` moved the start index backwards.
   
   Claus pointed at this line in the review of #28198 (CAMEL-25806). That PR 
guarded the page size of the newIssues poll; the shared `getIssues` is fixed 
here.
   
   Changes:
   - The page size is lowered only for `maxResults > 0`. The Jira Cloud path 
then also uses a page size of 50 instead of 0.
   - Not changed: the `maxResults` option description does not say that 0 or 
less means no limit. I left it alone to avoid regenerating the option metadata 
for a doc line; I can add it if you prefer.
   
   Tests:
   - New `WatchUpdatesConsumerMaxResultsZeroTest`: a watchUpdates route with 
`maxResults=0` and 60 issues. The search fake returns at most `maxResults` 
issues from `startAt` and the total, as Jira Server does (`maxResults=0` 
returns only the total), and throws if the same `startAt` is asked for more 
than 10 times in a row. On main the route does not start: 
`FailedToStartRouteException: ... The search is repeated at startAt 0`. With 
the fix, a change to an issue on the second page is routed.
   - camel-jira unit tests: 63 run, 0 failures. Formatter and import sort ran. 
Built offline with `-Dasm-version=9.11 -Dgrpc-version=1.84.2` because the 
versions of main were not in my local repository.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it): 
[CAMEL-25943](https://issues.apache.org/jira/browse/CAMEL-25943).
   
   # Apache Camel coding standards and style
   
   - [x] 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.
     (I built camel-jira and ran its tests, including the formatter and 
import-sort plugins. There are no generated file changes. I did not run the 
full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to