[ 
https://issues.apache.org/jira/browse/CAMEL-12653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16545649#comment-16545649
 ] 

ASF GitHub Bot commented on CAMEL-12653:
----------------------------------------

onderson closed pull request #2429: [CAMEL-12653] Pass given 'Exchange' to type 
converter
URL: https://github.com/apache/camel/pull/2429
 
 
   

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/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
 
b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
index b58ae577e50..7654c271488 100644
--- 
a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
+++ 
b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
@@ -266,11 +266,11 @@ public Object unmarshal(Exchange exchange, InputStream 
stream) throws IOExceptio
         try {
             Object answer;
 
-            XMLStreamReader xmlReader;
+            final XMLStreamReader xmlReader;
             if (needFiltering(exchange)) {
-                xmlReader = typeConverter.convertTo(XMLStreamReader.class, 
createNonXmlFilterReader(exchange, stream));
+                xmlReader = typeConverter.convertTo(XMLStreamReader.class, 
exchange, createNonXmlFilterReader(exchange, stream));
             } else {
-                xmlReader = typeConverter.convertTo(XMLStreamReader.class, 
stream);
+                xmlReader = typeConverter.convertTo(XMLStreamReader.class, 
exchange, stream);
             }
             String partClassFromHeader = 
exchange.getIn().getHeader(JaxbConstants.JAXB_PART_CLASS, String.class);
             if (partialClass != null || partClassFromHeader != null) {


 

----------------------------------------------------------------
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:
[email protected]


> JaxbDataFormat.unmarshal should use passed Exchange when converting given 
> InputStream into XMLStreamReader
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-12653
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12653
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jaxb
>    Affects Versions: 2.21.1
>            Reporter: Christian Ribeaud
>            Priority: Major
>
> From {{JaxbDataFormat.unmarshal}}:
> {code:java}
> ...
> XMLStreamReader xmlReader;
>   if (needFiltering(exchange)) {
>     xmlReader = typeConverter.convertTo(XMLStreamReader.class, 
> createNonXmlFilterReader(exchange, stream));
>   } else {
>     xmlReader = typeConverter.convertTo(XMLStreamReader.class, stream);
>   }
> ...
> {code}
> The passed {{Exchange}} is not used during the {{convertTo}} invocation. Any 
> other invocation in the *JaxbDataFormat* class passes the given {{Exchange}} 
> object.
> Passing the {{Exchange}} object gives a chance to the type converter to 
> configure itself before converting.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to