gnodet-bot commented on code in PR #29450:
URL: https://github.com/apache/camel/pull/29450#discussion_r4524597467
##########
components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfClientCallback.java:
##########
@@ -101,23 +117,47 @@ public void handleException(Map<String, Object> ctx,
Throwable ex) {
camelExchange.setException(ex);
}
} finally {
- // add cookies to the cookie store
- if (endpoint.getCookieHandler() != null &&
cxfExchange.getInMessage() != null) {
- try {
- Map<String, List<String>> cxfHeaders
- = CastUtils.cast((Map<?, ?>)
cxfExchange.getInMessage().get(CxfConstants.PROTOCOL_HEADERS));
- endpoint.getCookieHandler().storeCookies(camelExchange,
endpoint.getRequestUri(camelExchange), cxfHeaders);
- } catch (IOException e) {
- LOG.error("Cannot store cookies", e);
- }
- }
- // copy the context information and
- // call camel callback
// for one way messages callback is already called in
// process method of org.apache.camel.component.cxf.CxfProducer
if (!boi.getOperationInfo().isOneWay()) {
-
endpoint.getCxfBinding().populateExchangeFromCxfResponse(camelExchange,
cxfExchange, ctx);
- camelAsyncCallback.done(false);
+ // always signal the Camel callback, even if cookie store or
binding population throws,
+ // to prevent the calling thread from hanging in
DefaultAsyncProcessorAwaitManager
+ try {
+ // add cookies to the cookie store; catch Throwable so an
unexpected runtime failure
+ // does not prevent populateExchangeFromCxfResponse from
running or done() from firing;
+ // use suppressed to preserve the root transport/fault
exception already on the exchange
+ if (endpoint.getCookieHandler() != null &&
cxfExchange.getInMessage() != null) {
+ try {
+ Map<String, List<String>> cxfHeaders
+ = CastUtils.cast((Map<?, ?>)
cxfExchange.getInMessage().get(CxfConstants.PROTOCOL_HEADERS));
+
endpoint.getCookieHandler().storeCookies(camelExchange,
endpoint.getRequestUri(camelExchange),
+ cxfHeaders);
+ } catch (Throwable e) {
+ LOG.error("Cannot store cookies", e);
+ Throwable root = camelExchange.getException();
+ if (root != null) {
+ root.addSuppressed(e);
Review Comment:
Missing `root != e` self-suppression guard for consistency with the binding
catch blocks in this same method and in `handleResponse`. Although `root` and
`e` are always distinct objects in practice (different call sites), adding the
guard matches the explicit defensive comment in the adjacent block.
```suggestion
if (root != null && root != e) {
```
--
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]