oscerd commented on code in PR #28222:
URL: https://github.com/apache/camel/pull/28222#discussion_r4335170515


##########
components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerChannelHandler.java:
##########
@@ -229,6 +231,19 @@ protected Object getResponseBody(Exchange exchange) throws 
Exception {
         }
     }
 
+    /**
+     * The stand-in written back to the remote peer when {@code muteException} 
is enabled.
+     * <p>
+     * Still an {@link Exception}, so a peer that expects one - an object 
encoder serialises whatever was written -
+     * keeps getting one, but it carries neither the class nor the message of 
the route's exception. Its own stack trace
+     * is cleared as well: leaving it would serialise this consumer's frames 
to the peer instead.
+     */
+    private static Exception mutedException() {
+        Exception muted = new Exception(MUTED_EXCEPTION_MESSAGE);
+        muted.setStackTrace(new StackTraceElement[0]);

Review Comment:
   Added in 94fe38ba6d98: 
`NettyMuteExceptionTest.theExceptionHandedToAnObjectEncoderIsAPlainExceptionWithoutStackTraceOrCause`.
 A consumer with `encoders=#capturing-encoder`, a sharable 
`MessageToMessageEncoder<Object>` that records the object it is handed and 
stands in for an object encoder, checks that what gets written is a plain 
`java.lang.Exception` with the fixed message, a null cause and an empty stack 
trace.
   
   _Claude Code on behalf of Andrea Cosentino_



-- 
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