You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/01/30 06:35:10 UTC

svn commit: r1440281 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java

Author: ningjiang
Date: Wed Jan 30 05:35:10 2013
New Revision: 1440281

URL: http://svn.apache.org/viewvc?rev=1440281&view=rev
Log:
CAMEL-6020 Fixed the issue of Camel Transformer using inconsistent sources
Merged revisions 1440280 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1440280 | ningjiang | 2013-01-30 13:26:02 +0800 (Wed, 30 Jan 2013) | 1 line
  
  CAMEL-6020 Fixed the issue of Camel Transformer using inconsistent sources
........

Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1440280

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java?rev=1440281&r1=1440280&r2=1440281&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java Wed Jan 30 05:35:10 2013
@@ -456,26 +456,29 @@ public class XsltBuilder implements Proc
             return new StreamSource((InputStream)body);
         }
         if (body != null) {
-            TypeConverter tc = exchange.getContext().getTypeConverterRegistry().lookup(Source.class, body.getClass());
-            if (tc != null) {
-                source = tc.convertTo(Source.class, exchange, body);
+            if (isAllowStAX()) {
+                source = exchange.getContext().getTypeConverter().tryConvertTo(StAXSource.class, exchange, body);
+            }
+            if (source == null) {
+                // then try SAX
+                source = exchange.getContext().getTypeConverter().tryConvertTo(SAXSource.class, exchange, body);
+            }
+            if (source == null) {
+                // then try stream
+                source = exchange.getContext().getTypeConverter().tryConvertTo(StreamSource.class, exchange, body);
+            }
+            if (source == null) {
+                // and fallback to DOM
+                source = exchange.getContext().getTypeConverter().tryConvertTo(DOMSource.class, exchange, body);
+            }
+            // as the TypeConverterRegistry will look up source the converter differently if the type converter is loaded different
+            // now we just put the call of source converter at last
+            if (source == null) {
+                TypeConverter tc = exchange.getContext().getTypeConverterRegistry().lookup(Source.class, body.getClass());
+                if (tc != null) {
+                    source = tc.convertTo(Source.class, exchange, body);
+                }
             }
-        }
-
-        if (source == null && isAllowStAX()) {
-            source = exchange.getContext().getTypeConverter().tryConvertTo(StAXSource.class, exchange, body);
-        }
-        if (source == null) {
-            // then try SAX
-            source = exchange.getContext().getTypeConverter().tryConvertTo(SAXSource.class, exchange, body);
-        }
-        if (source == null) {
-            // then try stream
-            source = exchange.getContext().getTypeConverter().tryConvertTo(StreamSource.class, exchange, body);
-        }
-        if (source == null) {
-            // and fallback to DOM
-            source = exchange.getContext().getTypeConverter().tryConvertTo(DOMSource.class, exchange, body);
         }
         if (source == null) {
             if (isFailOnNullBody()) {