Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 164ABE1CA for ; Fri, 1 Feb 2013 15:11:03 +0000 (UTC) Received: (qmail 63371 invoked by uid 500); 1 Feb 2013 15:11:03 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 63203 invoked by uid 500); 1 Feb 2013 15:11:00 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 63176 invoked by uid 99); 1 Feb 2013 15:10:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Feb 2013 15:10:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Feb 2013 15:10:56 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 25D50238896F; Fri, 1 Feb 2013 15:10:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1441478 - in /camel/branches/camel-2.9.x: ./ camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java Date: Fri, 01 Feb 2013 15:10:36 -0000 To: commits@camel.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130201151036.25D50238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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()) {