davsclaus opened a new pull request, #25970: URL: https://github.com/apache/camel/pull/25970
Backport to `camel-4.18.x` of #25967, already reviewed and merged on `main`. - CAMEL-24573: camel-cxf - fix UnsupportedOperationException when copying a CXF JAXRS client factory bean from a Spring bean with a fixed-size `features` list (#25967, `98615a5d`) **Problem.** `CxfRsSpringEndpoint.newInstanceWithCommonProperties()` shallow-copies the `features` field from the source Spring bean. When that bean's `features` list is fixed-size (e.g. built with `Arrays.asList()`), the copy aliases the same immutable list, and a later attempt to append to it throws `UnsupportedOperationException`. **Fix.** Wrap the copied list in a new `ArrayList` so the copy is mutable, without touching the original Spring bean's list. **Not a straight cherry-pick — two deviations, both surfaced by building/testing this branch:** - Mechanical: `CxfRsSpringEndpointTest` keeps this branch's `org.apache.camel.test.spring.junit5.CamelSpringTestSupport` import rather than `main`'s `junit6` one — `camel-cxf-spring-rest` here depends on `camel-test-spring-junit5`, not `junit6`. - Behavioural: on this branch, `CxfRsSpringEndpoint.setupJAXRSClientFactoryBean()` does not call `setupCommonFactoryProperties()` — that call was added later by CAMEL-24183, which is not on `camel-4.18.x`. So the endpoint's own features are never auto-appended to the copied list here, and the ported test's `assertEquals(2, cfb.getFeatures().size())` did not hold (it failed with `expected: <2> but was: <1>` when run on this branch). The test now asserts the copied feature is preserved (size 1) and that the list is mutable by appending a second feature directly and re-checking the size (2) — this still exercises the fix (mutability) without relying on the CAMEL-24183 auto-append behaviour this branch doesn't have. Built and tested `camel-cxf-spring-rest` on this branch after adapting the test; all 4 tests in `CxfRsSpringEndpointTest` pass. _Claude Code on behalf of davsclaus_ ## Backport of #25967 **Original PR:** #25967 - CAMEL-24573: CXF REST: UnsupportedOperationException when copying factory bean with fixed-size features list **Original author:** @mcarlett **Target branch:** `camel-4.18.x` -- 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]
