Skip to content

CAMEL-24476/24477/24478: muteException for the mina, cxf and grpc consumers, backport to camel-4.18.x - #25935

Open
oscerd wants to merge 5 commits into
apache:camel-4.18.xfrom
oscerd:backport/glasswing-muteexception-4.18.x
Open

CAMEL-24476/24477/24478: muteException for the mina, cxf and grpc consumers, backport to camel-4.18.x#25935
oscerd wants to merge 5 commits into
apache:camel-4.18.xfrom
oscerd:backport/glasswing-muteexception-4.18.x

Conversation

@oscerd

@oscerd oscerd commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Backport to camel-4.18.x of three consumer fixes already reviewed and merged on main. Each aligns a consumer with the muteException behaviour CAMEL-23651 established for the HTTP consumers: a route failure no longer hands the remote caller the exception class, message or stack trace.

The same set is going to camel-4.22.x in #25934.

Behaviour change. muteException defaults to true, so a consumer that used to echo the failure now returns a generic error. Set muteException=false to restore the old output. This matches what CAMEL-23651 did for the HTTP consumers.

Deviations from a straight cherry-pick. This branch has diverged from main in the test layer and in CxfConsumer, so three commits needed manual resolution:

  • MinaMuteExceptionTest uses JUnit assertions instead of AssertJ. camel-mina has no assertj test dependency here and its other test classes are JUnit.
  • CxfConsumer keeps this branch's t instanceof Fault plus cast rather than main's pattern-matching form, and does not gain main's unrelated COMPLETED constant. The new test imports camel-test-junit5.
  • GrpcConsumerExceptionTest: GrpcTestSupport and its getRoutePort helper do not exist on this branch, so the test keeps the existing AvailablePortFinder constants and binds the unmuted route to a second fixed port, instead of main's port 0 plus route-id lookup.
  • The grpc commit on main also carried an unrelated YAML DSL schema regeneration that removes csimple. That hunk is left out; csimple is still valid on this branch.

The last commit regenerates the cxf and grpc catalog metadata from this branch's module descriptors, so no main-only metadata leaks into the catalog. Verified byte-for-byte against the module JSON.

The upgrade-guide entries are not included: the guides for every line live on main.

Built and tested per module on this branch (camel-mina, camel-cxf-soap, camel-grpc), including the new and touched tests.

Claude Code on behalf of oscerd

oscerd and others added 4 commits August 31, 2026 10:01
The consumer wrote exchange.getException() straight back over the socket, so a
route failure handed the remote peer the exception class and message over a
textline codec, and its serialised form over the object codec.

muteException defaults to true, matching the http consumers aligned by CAMEL-23651.

(cherry picked from commit 7af3e74)

MinaMuteExceptionTest uses JUnit assertions here: camel-mina on this branch has no
assertj test dependency, and its other test classes are JUnit.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
An exception thrown by the route was described back to the SOAP client in the
fault, exposing internal types and messages. Declared faults (@webfault) are
still reported as before, since those are part of the service contract.

(cherry picked from commit fd4fd27)

Conflicts resolved for this branch: CxfConsumer keeps the existing cast form of the
Fault check rather than main's pattern-matching one, and does not gain main's
unrelated COMPLETED constant. The test imports camel-test-junit5.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The consumer put the route exception's message into the gRPC status description,
so the caller received internal detail on failure.

(cherry picked from commit 3c99874)

Adapted for this branch: GrpcTestSupport and its getRoutePort helper do not exist
here, so GrpcConsumerExceptionTest keeps the existing AvailablePortFinder constants
and binds the unmuted route to a second fixed port instead of port 0 plus a route
id lookup. The main commit's unrelated YAML DSL schema regeneration, which drops
csimple, is left out.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The catalog copies are generated from the module descriptors, which the two
backported commits above changed. Regenerated here rather than taken from main,
so no main-only metadata comes across.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Croway

Croway commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

The CI failure is caused by the new CXF default, not infrastructure: GreeterClientCxfMessageTest still expects the original Spring Security exception text, while muteException=true now returns the generic fault. Both inherited test routes should explicitly set muteException=false to preserve that assertion; the apparent retry pass was actually skipped because port 9000 remained occupied.

Codex on behalf of Croway

CxfEndpoint's muteException consumer option now defaults to true (CAMEL-24477),
so an undeclared route failure such as this test's authorization denial no longer
leaks its message to the SOAP caller.

(cherry picked from commit f922ada)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@oscerd

oscerd commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the diagnosis — you were right that it is the new CXF default and not infrastructure.

I went a slightly different way than setting muteException=false on the two routes. main already dealt with this in f922ada7c747 (#25880): rather than opt the test out of the new default, it updated the inherited assertion in testServiceWithNotAuthorizedUser to expect the generic "Exchange processing failed" fault, since that is now the intended behaviour and what the 4.23 upgrade guide documents. The test then keeps covering what it is actually for.

That commit is a follow-up to the cxf change rather than part of it, which is exactly why I missed it when cherry-picking. I have now cherry-picked it onto this branch and onto the 4.22.x counterpart (#25934), which was failing the same way.

Also worth noting for the port-9000 observation: with the assertion fixed the test asserts rather than skips, so the retry should be a real pass.

Claude Code on behalf of oscerd

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, faithful backport of muteException (defaulting to true) for camel-mina (CAMEL-24476), camel-cxf (CAMEL-24477), and camel-grpc (CAMEL-24478) to camel-4.18.x. All three implementations match their main-branch counterparts; deviations are minor and justified by branch divergence.

Highlights:

  • The CXF implementation correctly preserves @WebFault-annotated exceptions (declared SOAP faults), ensuring muting applies only to undeclared route failures.
  • The gRPC implementation correctly mutes only the Status description (transmitted to client) while preserving withCause (stays local).
  • The Mina implementation returns a mutedException (plain Exception with cleared stack trace) rather than dropping the response, so synchronous peers aren't left to time out.
  • Existing tests properly adapted with muteException=false where they intentionally verify exception propagation. The GrpcConsumerExceptionTest adaptation using AvailablePortFinder is a clean approach for the branch divergence.

📋 PR Metadata

Aspect Current Suggested
Labels (none) bug
Milestone (none) 4.18.5

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants