[ https://issues.apache.org/jira/browse/CAMEL-12741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16588468#comment-16588468 ]
ASF GitHub Bot commented on CAMEL-12741: ---------------------------------------- zregvart closed pull request #2483: CAMEL-12741: type conversion with SjmsMessage URL: https://github.com/apache/camel/pull/2483 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java b/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java index a2ae7e73a2a..3307c145820 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java +++ b/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java @@ -94,6 +94,18 @@ public Object getMandatoryBody() throws InvalidPayloadException { if (answer != null) { return answer; } + } else if (camelContext != null) { + TypeConverter converter = camelContext.getTypeConverter(); + + T answer = converter.convertTo(type, body); + if (answer != null) { + return answer; + } + + answer = converter.tryConvertTo(type, this); + if (answer != null) { + return answer; + } } // not possible to convert diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsMessage.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsMessage.java index d3520346ccb..bdac87e6326 100644 --- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsMessage.java +++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsMessage.java @@ -101,6 +101,8 @@ public void copyFrom(org.apache.camel.Message that) { if (that.hasAttachments()) { getAttachmentObjects().putAll(that.getAttachmentObjects()); } + + setExchange(that.getExchange()); } public JmsBinding getBinding() { ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > SjmsMessage should set Exchange in copyFrom > ------------------------------------------- > > Key: CAMEL-12741 > URL: https://issues.apache.org/jira/browse/CAMEL-12741 > Project: Camel > Issue Type: Bug > Components: camel-sjms > Reporter: Zoran Regvart > Assignee: Zoran Regvart > Priority: Major > Fix For: 2.23.0 > > > When a copy of the {{SjmsMessage}} is created using {{copyFrom(Message)}} the > resulting message copy doesn't have the {{Exchange}} set. This prevents the > use of {{TypeConverter}} when {{Message:getBody(Class)}} is invoked. -- This message was sent by Atlassian JIRA (v7.6.3#76005)