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/02/01 16:10:36 UTC
svn commit: r1441478 - in /camel/branches/camel-2.9.x: ./
camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
Author: ningjiang
Date: Fri Feb 1 15:10:35 2013
New Revision: 1441478
URL: http://svn.apache.org/viewvc?rev=1441478&view=rev
Log:
CAMEL-6020 Fixed the issue of Camel Transformer using inconsistent sources
Merged revisions 1440281 via svnmerge from
https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x
................
r1440281 | ningjiang | 2013-01-30 13:35:10 +0800 (Wed, 30 Jan 2013) | 10 lines
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.9.x/ (props changed)
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1440280
Merged /camel/branches/camel-2.10.x:r1440281
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java?rev=1441478&r1=1441477&r2=1441478&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java (original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java Fri Feb 1 15:10:35 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()) {