gnodet commented on code in PR #22358:
URL: https://github.com/apache/camel/pull/22358#discussion_r3050513795


##########
core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java:
##########
@@ -442,7 +442,11 @@ private static void copyFromOutMessage(Exchange result, 
Exchange source, boolean
      */
     public static Message getResultMessage(Exchange exchange) {
         if (exchange.getPattern().isOutCapable()) {
-            return exchange.getOut();
+            // explicitly create response if none exists (preserves old 
getOut() lazy-creation semantics)
+            if (!hasResponse(exchange)) {
+                return createResponse(exchange);
+            }
+            return exchange.getMessage();

Review Comment:
   **Explicit response creation preserves `getOut()` lazy-creation semantics**
   
   `getResultMessage()` is used by CXF, SOAP, and other components that expect 
an OUT message to exist after calling this method. The old code returned 
`exchange.getOut()` which lazily created an empty OUT as a side effect. The new 
code makes this explicit via `createResponse()` — the intent is now visible in 
the code rather than hidden behind a getter.
   
   _Claude Code on behalf of Guillaume Nodet_



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