You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/08/01 07:33:14 UTC
[camel] 02/03: CAMEL-19670: camel-core - useOriginalMessage should do like stream-caching advice making defensive copy that is safe to re-read. Added unit test from Bartosz Popiela into camel-zipfile.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch sc-original-3
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 37ceb0973212772aae46474a5dc6eb6c7aa9e13d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Aug 1 08:58:52 2023 +0200
CAMEL-19670: camel-core - useOriginalMessage should do like stream-caching advice making defensive copy that is safe to re-read. Added unit test from Bartosz Popiela into camel-zipfile.
---
.../java/org/apache/camel/impl/engine/StreamCachingHelper.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/StreamCachingHelper.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/StreamCachingHelper.java
index 63fba73c035..a2c876363e7 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/StreamCachingHelper.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/StreamCachingHelper.java
@@ -18,6 +18,7 @@ package org.apache.camel.impl.engine;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePropertyKey;
+import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.StreamCache;
import org.apache.camel.StreamCacheException;
@@ -50,7 +51,7 @@ final class StreamCachingHelper {
exchange.setException(tce);
// because this is stream caching error then we cannot use redelivery as the message body is corrupt
// so mark as redelivery exhausted
- exchange.getExchangeExtension().setRedeliveryExhausted(true);
+ exchange.adapt(ExtendedExchange.class).setRedeliveryExhausted(true);
}
// check if we somewhere failed due to a stream caching exception
Throwable cause = exchange.getException();
@@ -64,7 +65,7 @@ final class StreamCachingHelper {
StreamCachingStrategy strategy, Exchange exchange, Message inMessage, Throwable cause) {
final boolean failed = cause != null && ObjectHelper.getException(StreamCacheException.class, cause) != null;
if (!failed) {
- boolean disabled = exchange.getExchangeExtension().isStreamCacheDisabled();
+ boolean disabled = exchange.adapt(ExtendedExchange.class).isStreamCacheDisabled();
if (disabled) {
return null;
}
@@ -81,7 +82,7 @@ final class StreamCachingHelper {
exchange.setException(tce);
// because this is stream caching error then we cannot use redelivery as the message body is corrupt
// so mark as redelivery exhausted
- exchange.getExchangeExtension().setRedeliveryExhausted(true);
+ exchange.adapt(ExtendedExchange.class).setRedeliveryExhausted(true);
}
}
return null;