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 2022/01/29 08:37:19 UTC
[camel] branch camel-3.14.x updated: CAMEL-17565: camel-jms - Using stream JMS message type should close read input stream from message body.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.14.x by this push:
new 9a059b5 CAMEL-17565: camel-jms - Using stream JMS message type should close read input stream from message body.
9a059b5 is described below
commit 9a059b51a5e98c7f8250fbf99ab8c694164444c7
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jan 29 09:34:56 2022 +0100
CAMEL-17565: camel-jms - Using stream JMS message type should close read input stream from message body.
---
.../src/main/java/org/apache/camel/component/jms/JmsBinding.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
index 53dc0f3..da4c35d 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
@@ -698,8 +698,9 @@ public class JmsBinding {
StreamMessage message = session.createStreamMessage();
if (body != null) {
long size = 0;
+ InputStream is = null;
try {
- InputStream is = context.getTypeConverter().mandatoryConvertTo(InputStream.class, exchange, body);
+ is = context.getTypeConverter().mandatoryConvertTo(InputStream.class, exchange, body);
LOG.trace("Writing payload in StreamMessage");
// assume streaming is bigger payload so use same buffer size as the file component
byte[] buffer = new byte[FileUtil.BUFFER_SIZE];
@@ -720,7 +721,10 @@ public class JmsBinding {
JMSException cause = new MessageFormatException(e.getMessage());
cause.initCause(e);
throw cause;
+ } finally {
+ IOHelper.close(is);
}
+
}
return message;
}