[
https://issues.apache.org/jira/browse/CAMEL-24428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrea Cosentino updated CAMEL-24428:
-------------------------------------
Description:
CAMEL-23651 aligned the {{muteException}} consumer option so that a failed
exchange does not return the exception's stack trace or message to the remote
caller. The option exists in camel-http-common (and therefore camel-servlet and
camel-jetty), camel-http, camel-netty-http, camel-platform-http and
camel-undertow. A grep for {{muteException}} across {{components/}} still shows
it in the http family only.
{{KnativeHttpConsumer.computeResponseBody()}} returns the *full stack trace* of
the route exception as the response body, unconditionally:
{code:java}
Exception exception = message.getExchange().getException();
if (exception != null) {
// we failed due an exception so print it as plain text
final String stackTrace = ExceptionHelper.stackTraceToString(exception);
// the body should then be the stacktrace
body = stackTrace.getBytes(StandardCharsets.UTF_8);
// force content type to be text/plain as that is what the stacktrace is
message.setHeader(Exchange.CONTENT_TYPE, "text/plain");
{code}
Proposal: add a {{muteException}} consumer option, defaulting to {{true}} to
match the post-CAMEL-23651 behaviour of the http family, with an upgrade-guide
entry noting that routes relying on the detail must set it to {{false}}
explicitly.
*This issue was rescoped to camel-knative only.* The three other consumers it
originally covered are now tracked separately so that each can be fixed and
released on its own:
* CAMEL-24476 - camel-mina
* CAMEL-24477 - camel-cxf
* CAMEL-24478 - camel-grpc
was:
CAMEL-23651 aligned the muteException consumer option so that a failed exchange
does not return the exception's stack trace or message to the remote caller.
The option exists in camel-http-common (and therefore camel-servlet and
camel-jetty), camel-http, camel-netty-http, camel-platform-http and
camel-undertow.
Four consumers that return processing failures to the caller have no equivalent:
* camel-knative KnativeHttpConsumer.computeResponseBody() returns
ExceptionHelper.stackTraceToString(exception) as the text/plain 500 body
* camel-mina MinaConsumer serialises exchange.getException() back over the
socket
* camel-cxf CxfConsumer puts route exception messages into the SOAP fault
* camel-grpc GrpcMethodHandler returns the raw exception message to the client
A grep for muteException across components/ shows the option in the http family
only.
Proposal: add a muteException option to each of these four, defaulting to true
to match the post-CAMEL-23651 behaviour of the http family, with an
upgrade-guide entry noting that routes relying on the detail in the response
must set it to false explicitly. The four are independent and can land as
separate commits under this issue.
Summary: camel-knative - add a muteException consumer option (was:
camel-knative, camel-mina, camel-cxf, camel-grpc - add a muteException option
like the other consumers have)
> camel-knative - add a muteException consumer option
> ---------------------------------------------------
>
> Key: CAMEL-24428
> URL: https://issues.apache.org/jira/browse/CAMEL-24428
> Project: Camel
> Issue Type: Improvement
> Components: camel-knative
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 4.23.0
>
>
> CAMEL-23651 aligned the {{muteException}} consumer option so that a failed
> exchange does not return the exception's stack trace or message to the remote
> caller. The option exists in camel-http-common (and therefore camel-servlet
> and camel-jetty), camel-http, camel-netty-http, camel-platform-http and
> camel-undertow. A grep for {{muteException}} across {{components/}} still
> shows it in the http family only.
> {{KnativeHttpConsumer.computeResponseBody()}} returns the *full stack trace*
> of the route exception as the response body, unconditionally:
> {code:java}
> Exception exception = message.getExchange().getException();
> if (exception != null) {
> // we failed due an exception so print it as plain text
> final String stackTrace = ExceptionHelper.stackTraceToString(exception);
> // the body should then be the stacktrace
> body = stackTrace.getBytes(StandardCharsets.UTF_8);
> // force content type to be text/plain as that is what the stacktrace is
> message.setHeader(Exchange.CONTENT_TYPE, "text/plain");
> {code}
> Proposal: add a {{muteException}} consumer option, defaulting to {{true}} to
> match the post-CAMEL-23651 behaviour of the http family, with an
> upgrade-guide entry noting that routes relying on the detail must set it to
> {{false}} explicitly.
> *This issue was rescoped to camel-knative only.* The three other consumers it
> originally covered are now tracked separately so that each can be fixed and
> released on its own:
> * CAMEL-24476 - camel-mina
> * CAMEL-24477 - camel-cxf
> * CAMEL-24478 - camel-grpc
--
This message was sent by Atlassian Jira
(v8.20.10#820010)