camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1420526 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java
Date Wed, 12 Dec 2012 05:05:13 GMT
Author: ningjiang
Date: Wed Dec 12 05:05:12 2012
New Revision: 1420526

URL: http://svn.apache.org/viewvc?rev=1420526&view=rev
Log:
CAMEL-5864 fixed the camel-xslt component NPE when the message body is byte[]
Merged revisions 1420523 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1420523 | ningjiang | 2012-12-12 12:43:56 +0800 (Wed, 12 Dec 2012) | 1 line
  
  CAMEL-5864 fixed the camel-xslt component NPE when the message body is byte[]
........

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
    camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java

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

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=1420526&r1=1420525&r2=1420526&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 Dec 12 05:05:12 2012
@@ -458,7 +458,7 @@ public class XsltBuilder implements Proc
         if (body != null) {
             TypeConverter tc = exchange.getContext().getTypeConverterRegistry().lookup(Source.class,
body.getClass());
             if (tc != null) {
-                source = tc.convertTo(Source.class, body);
+                source = tc.convertTo(Source.class, exchange, body);
             }
         }
 

Modified: camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java?rev=1420526&r1=1420525&r2=1420526&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java
(original)
+++ camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java
Wed Dec 12 05:05:12 2012
@@ -24,17 +24,20 @@ import org.apache.camel.builder.RouteBui
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.impl.JndiRegistry;
 
-/**
- *
- */
 public class XsltRouteTest extends ContextTestSupport {
+    public void testSendStringMessage() throws Exception {
+        sendMessageAndHaveItTransformed("<mail><subject>Hey</subject><body>Hello
world!</body></mail>");
+    }
+    
+    public void testSendBytesMessage() throws Exception {
+        sendMessageAndHaveItTransformed("<mail><subject>Hey</subject><body>Hello
world!</body></mail>".getBytes());
+    }
 
-    public void testSendMessageAndHaveItTransformed() throws Exception {
+    private void sendMessageAndHaveItTransformed(Object body) throws Exception {
         MockEndpoint endpoint = getMockEndpoint("mock:result");
         endpoint.expectedMessageCount(1);
 
-        template.sendBody("direct:start",
-                "<mail><subject>Hey</subject><body>Hello world!</body></mail>");
+        template.sendBody("direct:start", body);
 
         assertMockEndpointsSatisfied();
 



Mime
View raw message