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


##########
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:
   Optional: the new tests only cover textline, where just `toString()` reaches 
the wire. This cleared stack trace (and the absence of a cause) only matters 
when the peer gets the serialised object, which happens with a user-configured 
object encoder, since the default non-textline codec is a String encoder. A 
small test that captures the written object and checks it is a plain 
`Exception` with an empty stack trace and a null cause would lock in the 
guarantee this javadoc describes.



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