urunni88 opened a new pull request, #28790: URL: https://github.com/apache/camel/pull/28790
# Description [CAMEL-25972](https://issues.apache.org/jira/browse/CAMEL-25972): `controlbus:route?routeId=...&action=stats` for a route that does not exist passed a null route to `getObjectNameForRoute`, which threw a `NullPointerException`. The task logged and ignored it, so the body was left as it was, and the existing "Cannot lookup route with id ..." text was never reached. As proposed on the JIRA, `statsAction` now looks up the MBean name only when the route exists, so a missing route gives the "Cannot lookup route with id ..." text as the body. Test: `ControlBusStatsTest.testControlBusRouteStatUnknownRoute` (in camel-management, where the stats tests need JMX) sends to `stats` for an unknown route and checks the body. It fails without the fix (the body stays `Hello World`) and passes with it. The controlbus tests in camel-core and camel-management pass. The JIRA lists 4.18.0 and 4.22.0 as affected too, in case a backport is wanted. # 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). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [x] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. # 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 the help of Claude (Anthropic), credited with a `Co-authored-by` trailer in the commit. -- 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]
