gnodet-bot commented on code in PR #29188:
URL: https://github.com/apache/camel/pull/29188#discussion_r4472140811


##########
components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyPayloadHelper.java:
##########
@@ -108,6 +125,44 @@ public static void setOut(Exchange exchange, Object 
payload) {
         }
     }
 
+    /**
+     * A decoded {@link DefaultExchangeHolder} rebuilds the entire Exchange 
(id, body, headers, out message, properties
+     * and variables), so it is only unmarshalled when the endpoint has 
explicitly enabled exchange transfer via
+     * {@code transferExchange=true}. Otherwise the payload is treated as a 
normal message body.
+     */
+    private static boolean isExchangeTransfer(NettyEndpoint endpoint, Object 
payload) {
+        return payload instanceof DefaultExchangeHolder
+                && endpoint != null && 
endpoint.getConfiguration().isTransferExchange();
+    }
+
+    /**
+     * @deprecated          use {@link #setIn(NettyEndpoint, Exchange, 
Object)}. This overload has no endpoint and so
+     *                      cannot check {@code transferExchange}: since 
4.24.0 it never unmarshals a
+     *                      {@link DefaultExchangeHolder} and sets any 
payload, a holder included, as the message body.
+     *                      A caller that relied on the unconditional 
unmarshalling of earlier versions has to pass its
+     *                      endpoint to the three-argument overload.
+     * @param      exchange the exchange
+     * @param      payload  the decoded payload
+     */
+    @Deprecated(since = "4.24.0", forRemoval = true)

Review Comment:
   ⚠️ **Wrong `@Deprecated(since)` for this branch.** `4.24.0` does not exist 
on `camel-4.22.x`. The branch is at `4.22.3-SNAPSHOT`, so this deprecation 
ships in `4.22.3`.
   
   ```suggestion
       @Deprecated(since = "4.22.3", forRemoval = true)
   ```



##########
components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyPayloadHelper.java:
##########
@@ -108,6 +125,44 @@ public static void setOut(Exchange exchange, Object 
payload) {
         }
     }
 
+    /**
+     * A decoded {@link DefaultExchangeHolder} rebuilds the entire Exchange 
(id, body, headers, out message, properties
+     * and variables), so it is only unmarshalled when the endpoint has 
explicitly enabled exchange transfer via
+     * {@code transferExchange=true}. Otherwise the payload is treated as a 
normal message body.
+     */
+    private static boolean isExchangeTransfer(NettyEndpoint endpoint, Object 
payload) {
+        return payload instanceof DefaultExchangeHolder
+                && endpoint != null && 
endpoint.getConfiguration().isTransferExchange();
+    }
+
+    /**
+     * @deprecated          use {@link #setIn(NettyEndpoint, Exchange, 
Object)}. This overload has no endpoint and so
+     *                      cannot check {@code transferExchange}: since 
4.24.0 it never unmarshals a
+     *                      {@link DefaultExchangeHolder} and sets any 
payload, a holder included, as the message body.
+     *                      A caller that relied on the unconditional 
unmarshalling of earlier versions has to pass its
+     *                      endpoint to the three-argument overload.
+     * @param      exchange the exchange
+     * @param      payload  the decoded payload
+     */
+    @Deprecated(since = "4.24.0", forRemoval = true)
+    public static void setIn(Exchange exchange, Object payload) {
+        setIn(null, exchange, payload);
+    }
+
+    /**
+     * @deprecated          use {@link #setOut(NettyEndpoint, Exchange, 
Object)}. This overload has no endpoint and so
+     *                      cannot check {@code transferExchange}: since 
4.24.0 it never unmarshals a
+     *                      {@link DefaultExchangeHolder} and sets any 
payload, a holder included, as the message body.
+     *                      A caller that relied on the unconditional 
unmarshalling of earlier versions has to pass its
+     *                      endpoint to the three-argument overload.
+     * @param      exchange the exchange
+     * @param      payload  the decoded payload
+     */
+    @Deprecated(since = "4.24.0", forRemoval = true)

Review Comment:
   ⚠️ Same issue — `@Deprecated(since = "4.24.0")` is incorrect on this branch.
   
   ```suggestion
       @Deprecated(since = "4.22.3", forRemoval = true)
   ```



##########
components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyPayloadHelper.java:
##########
@@ -108,6 +125,44 @@ public static void setOut(Exchange exchange, Object 
payload) {
         }
     }
 
+    /**
+     * A decoded {@link DefaultExchangeHolder} rebuilds the entire Exchange 
(id, body, headers, out message, properties
+     * and variables), so it is only unmarshalled when the endpoint has 
explicitly enabled exchange transfer via
+     * {@code transferExchange=true}. Otherwise the payload is treated as a 
normal message body.
+     */
+    private static boolean isExchangeTransfer(NettyEndpoint endpoint, Object 
payload) {
+        return payload instanceof DefaultExchangeHolder
+                && endpoint != null && 
endpoint.getConfiguration().isTransferExchange();
+    }
+
+    /**
+     * @deprecated          use {@link #setIn(NettyEndpoint, Exchange, 
Object)}. This overload has no endpoint and so
+     *                      cannot check {@code transferExchange}: since 
4.24.0 it never unmarshals a

Review Comment:
   The prose "since 4.24.0" in this Javadoc is also wrong for this branch — 
should read "since 4.22.3" to match the actual release.
   
   ```suggestion
        *                      cannot check {@code transferExchange}: since 
4.22.3 it never unmarshals a
   ```



##########
components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyPayloadHelper.java:
##########
@@ -108,6 +125,44 @@ public static void setOut(Exchange exchange, Object 
payload) {
         }
     }
 
+    /**
+     * A decoded {@link DefaultExchangeHolder} rebuilds the entire Exchange 
(id, body, headers, out message, properties
+     * and variables), so it is only unmarshalled when the endpoint has 
explicitly enabled exchange transfer via
+     * {@code transferExchange=true}. Otherwise the payload is treated as a 
normal message body.
+     */
+    private static boolean isExchangeTransfer(NettyEndpoint endpoint, Object 
payload) {
+        return payload instanceof DefaultExchangeHolder
+                && endpoint != null && 
endpoint.getConfiguration().isTransferExchange();
+    }
+
+    /**
+     * @deprecated          use {@link #setIn(NettyEndpoint, Exchange, 
Object)}. This overload has no endpoint and so
+     *                      cannot check {@code transferExchange}: since 
4.24.0 it never unmarshals a
+     *                      {@link DefaultExchangeHolder} and sets any 
payload, a holder included, as the message body.
+     *                      A caller that relied on the unconditional 
unmarshalling of earlier versions has to pass its
+     *                      endpoint to the three-argument overload.
+     * @param      exchange the exchange
+     * @param      payload  the decoded payload
+     */
+    @Deprecated(since = "4.24.0", forRemoval = true)
+    public static void setIn(Exchange exchange, Object payload) {
+        setIn(null, exchange, payload);
+    }
+
+    /**
+     * @deprecated          use {@link #setOut(NettyEndpoint, Exchange, 
Object)}. This overload has no endpoint and so
+     *                      cannot check {@code transferExchange}: since 
4.24.0 it never unmarshals a

Review Comment:
   Same — "since 4.24.0" should be "since 4.22.3" here.
   
   ```suggestion
        *                      cannot check {@code transferExchange}: since 
4.22.3 it never unmarshals a
   ```



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