You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/06/20 13:48:36 UTC

[1/3] git commit: CAMEL-6467: Added new mustache component to kit. Fixed CS.

Updated Branches:
  refs/heads/master 5ec63db94 -> efbb85961


CAMEL-6467: Added new mustache component to kit. Fixed CS.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/82434981
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/82434981
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/82434981

Branch: refs/heads/master
Commit: 82434981491f7198aebc817c4b7b13607eac5990
Parents: 5ec63db
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jun 20 11:36:20 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jun 20 11:36:20 2013 +0200

----------------------------------------------------------------------
 components/camel-mustache/ReadMe.wiki           | 96 --------------------
 .../component/mustache/MustacheLetterTest.java  |  2 +-
 2 files changed, 1 insertion(+), 97 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/82434981/components/camel-mustache/ReadMe.wiki
----------------------------------------------------------------------
diff --git a/components/camel-mustache/ReadMe.wiki b/components/camel-mustache/ReadMe.wiki
deleted file mode 100644
index 0642e9b..0000000
--- a/components/camel-mustache/ReadMe.wiki
+++ /dev/null
@@ -1,96 +0,0 @@
-h2. Mustache
-
-The *mustache:* component allows for processing a message using a [Mustache|http://mustache.github.io/] template. This can be ideal when using [Templating] to generate responses for requests.
-
-Maven users will need to add the following dependency to their {{pom.xml}} for this component:
-{code:xml}
-<dependency>
-<groupId>org.apache.camel</groupId>
-<artifactId>camel-mustache</artifactId>
-<version>x.x.x</version> <!-- use the same version as your Camel core version -->
-</dependency>
-{code}
-
-h3. URI format
-
-{code}
-mustache:templateName[?options]
-{code}
-
-Where *templateName* is the classpath-local URI of the template to invoke; or the complete URL of the remote template (eg: file://folder/myfile.mustache).
-
-You can append query options to the URI in the following format, {{?option=value&option=value&...}}
-
-h3. Options
-{div:class=confluenceTableSmall}
-|| Option || Default || Description ||
-| {{encoding}} | {{null}} | Character encoding of the resource content. |
-| {{startDelimiter}} | {{ | Characters used to mark template code beginning. |
-| {{endDelimiter}} | }} | Characters used to mark template code end. |
-{div}
-
-h3. Mustache Context
-Camel will provide exchange information in the Mustache context (just a {{Map}}). The {{Exchange}} is transferred as:
-{div:class=confluenceTableSmall}
-|| key || value ||
-| {{exchange}} | The {{Exchange}} itself. |
-| {{exchange.properties}} | The {{Exchange}} properties. |
-| {{headers}} | The headers of the In message. |
-| {{camelContext}} | The Camel Context. |
-| {{request}} | The In message. |
-| {{body}} | The In message body. |
-| {{response}} | The Out message (only for InOut message exchange pattern). |
-{div}
-
-h3. Dynamic templates
-
-Camel provides two headers by which you can define a different resource location for a template or the template content itself. If any of these headers is set then Camel uses this over the endpoint configured resource. This allows you to provide a dynamic template at runtime.
-{div:class=confluenceTableSmall}
-|| Header || Type || Description || Support Version ||
-| MustacheConstants.MUSTACHE_RESOURCE | org.springframework.core.io.Resource | The template resource | |
-| MustacheConstants.MUSTACHE_RESOURCE_URI | String | A URI for the template resource to use instead of the endpoint configured. | |
-| MustacheConstants.MUSTACHE_TEMPLATE | String | The template to use instead of the endpoint configured. | |
-{div}
-
-h3. Samples
-
-For example you could use something like:
-
-{code}
-from("activemq:My.Queue").
-to("mustache:com/acme/MyResponse.mustache");
-{code}
-
-To use a Mustache template to formulate a response for a message for InOut message exchanges (where there is a {{JMSReplyTo}} header).
-
-If you want to use InOnly and consume the message and send it to another destination you could use:
-
-{code}
-from("activemq:My.Queue").
-to("mustache:com/acme/MyResponse.mustache").
-to("activemq:Another.Queue");
-{code}
-
-It's possible to specify what template the component should use dynamically via a header, so for example:
-{code}
-from("direct:in").
-setHeader(MustacheConstants.MUSTACHE_RESOURCE_URI).constant("path/to/my/template.mustache").
-to("mustache:dummy");
-{code}
-
-h3. The Email Sample
-In this sample we want to use Mustache templating for an order confirmation email. The email template is laid out in Mustache as:
-{code}
-Dear {{headers.lastName}}}, {{headers.firstName}}
-
-Thanks for the order of {{headers.item}}.
-
-Regards Camel Riders Bookstore
-{{body}}
-{code}
-
-And the java code:
-
-{snippet:id=e1|lang=java|url=camel/trunk/components/camel-mustache/src/test/java/org/apache/camel/component/mustache/MustacheLetterTest.java}
-
-{include:Endpoint See Also} 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/82434981/components/camel-mustache/src/test/java/org/apache/camel/component/mustache/MustacheLetterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mustache/src/test/java/org/apache/camel/component/mustache/MustacheLetterTest.java b/components/camel-mustache/src/test/java/org/apache/camel/component/mustache/MustacheLetterTest.java
index fa5c255..a374714 100644
--- a/components/camel-mustache/src/test/java/org/apache/camel/component/mustache/MustacheLetterTest.java
+++ b/components/camel-mustache/src/test/java/org/apache/camel/component/mustache/MustacheLetterTest.java
@@ -42,7 +42,7 @@ public class MustacheLetterTest extends CamelTestSupport {
     }
 
     @Test
-    public void testFreemarkerLetter() throws Exception {
+    public void testMustacheLetter() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
         mock.expectedBodiesReceived("Dear Ibsen, Claus\n\nThanks for the order of Camel in Action."


[3/3] git commit: CAMEL-6471: CXF in PAYLOAD mode should not output body/headers in the toString as that may force loading into memory. Also log if payload mode is allowing streaming or not, as thats not easy to see how is configured.

Posted by da...@apache.org.
CAMEL-6471: CXF in PAYLOAD mode should not output body/headers in the toString as that may force loading into memory. Also log if payload mode is allowing streaming or not, as thats not easy to see how is configured.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/efbb8596
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/efbb8596
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/efbb8596

Branch: refs/heads/master
Commit: efbb85961a2ad932d15164a01e2823ce1fe0ef54
Parents: b5c5c26
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jun 20 13:48:16 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jun 20 13:48:16 2013 +0200

----------------------------------------------------------------------
 .../apache/camel/component/cxf/CxfPayload.java  | 29 ++------------------
 .../cxf/feature/PayLoadDataFormatFeature.java   |  4 +++
 2 files changed, 6 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/efbb8596/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
index f40efcd..2fad481 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfPayload.java
@@ -130,34 +130,9 @@ public class CxfPayload<T> {
         return headers;
     }
     
-    /**
-     * Returns the contents as a String
-     * Important notes:
-     *   1) This requires the message to be fully loaded breaking the streaming
-     *   2) For large messages, the result can be a VERY large String and require
-     *   large amounts of memory.
-     */
     public String toString() {
-        StringBuilder buf = new StringBuilder();
-        buf.append(getClass().getName());
-        buf.append(" headers: " + headers);
-        // go through the list of element and turn it into String
-        if (body == null) {
-            buf.append("body: " + body);
-        } else {
-            buf.append("body: [ ");
-            for (Element src : getBody()) {
-                String elementString;
-                try {
-                    elementString = StaxUtils.toString(src);
-                } catch (XMLStreamException e) {
-                    elementString = src.toString();
-                }
-                buf.append("[" + elementString + "]");
-            }
-            buf.append("]");
-        }
-        return buf.toString();
+        // do not load or print the payload body etc as we do not want to load that into memory etc
+        return super.toString();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/efbb8596/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
index 4642358..dae5b86 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
@@ -85,6 +85,8 @@ public class PayLoadDataFormatFeature extends AbstractDataFormatFeature {
                           SoapHeaderInterceptor.class);
         client.getEndpoint().getBinding().getInInterceptors().add(new ConfigureDocLitWrapperInterceptor(true));
         resetPartTypes(client.getEndpoint().getBinding());
+
+        LOG.info("Initialized CXF Client: {} in Payload mode with allow streaming: {}", client, allowStreaming);
     }
 
 
@@ -103,6 +105,8 @@ public class PayLoadDataFormatFeature extends AbstractDataFormatFeature {
         removeInterceptor(server.getEndpoint().getBinding().getInInterceptors(), 
                           SoapHeaderInterceptor.class);
         resetPartTypes(server.getEndpoint().getBinding());
+
+        LOG.info("Initialized CXF Server: {} in Payload mode with allow streaming: {}", server, allowStreaming);
     }
 
     @Override


[2/3] git commit: CAMEL-6455: Improved exception message when bean parameter binding fails.

Posted by da...@apache.org.
CAMEL-6455: Improved exception message when bean parameter binding fails.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b5c5c262
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b5c5c262
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b5c5c262

Branch: refs/heads/master
Commit: b5c5c262f5304e6c4ca98fd165a62681f309b052
Parents: 8243498
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jun 20 13:24:23 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jun 20 13:24:23 2013 +0200

----------------------------------------------------------------------
 .../apache/camel/component/bean/MethodInfo.java | 27 +++++----
 .../bean/ParameterBindingException.java         | 59 ++++++++++++++++++++
 ...eterAndNoMethodWithNoParameterIssueTest.java |  4 +-
 ...nNoTypeConvertionPossibleWhenHeaderTest.java |  7 ++-
 .../bean/BeanOverloadedMethodFQNTest.java       |  4 +-
 .../bean/BeanParameterInvalidValueTest.java     |  4 +-
 6 files changed, 88 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b5c5c262/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java b/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
index 205e285..721a2c5 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
@@ -535,17 +535,19 @@ public class MethodInfo {
                             if (parameterValue instanceof String) {
                                 parameterValue = StringHelper.removeLeadingAndEndingQuotes((String) parameterValue);
                             }
-                            try {
-                                // its a valid parameter value, so convert it to the expected type of the parameter
-                                answer = exchange.getContext().getTypeConverter().mandatoryConvertTo(parameterType, exchange, parameterValue);
-                                if (LOG.isTraceEnabled()) {
-                                    LOG.trace("Parameter #{} evaluated as: {} type: ", new Object[]{index, answer, ObjectHelper.type(answer)});
+                            if (parameterValue != null) {
+                                try {
+                                    // its a valid parameter value, so convert it to the expected type of the parameter
+                                    answer = exchange.getContext().getTypeConverter().mandatoryConvertTo(parameterType, exchange, parameterValue);
+                                    if (LOG.isTraceEnabled()) {
+                                        LOG.trace("Parameter #{} evaluated as: {} type: ", new Object[]{index, answer, ObjectHelper.type(answer)});
+                                    }
+                                } catch (Exception e) {
+                                    if (LOG.isDebugEnabled()) {
+                                        LOG.debug("Cannot convert from type: {} to type: {} for parameter #{}", new Object[]{ObjectHelper.type(parameterValue), parameterType, index});
+                                    }
+                                    throw new ParameterBindingException(e, method, index, parameterType, parameterValue);
                                 }
-                            } catch (NoTypeConversionAvailableException e) {
-                                if (LOG.isDebugEnabled()) {
-                                    LOG.debug("Cannot convert from type: {} to type: {} for parameter #{}", new Object[]{ObjectHelper.type(parameterValue), parameterType, index});
-                                }
-                                throw ObjectHelper.wrapCamelExecutionException(exchange, e);
                             }
                         }
                     }
@@ -570,7 +572,10 @@ public class MethodInfo {
                             LOG.trace("Parameter #{} evaluated as: {} type: ", new Object[]{index, answer, ObjectHelper.type(answer)});
                         }
                     } catch (NoTypeConversionAvailableException e) {
-                        throw ObjectHelper.wrapCamelExecutionException(exchange, e);
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug("Cannot convert from type: {} to type: {} for parameter #{}", new Object[]{ObjectHelper.type(result), parameterType, index});
+                        }
+                        throw new ParameterBindingException(e, method, index, parameterType, result);
                     }
                 } else {
                     LOG.trace("Parameter #{} evaluated as null", index);

http://git-wip-us.apache.org/repos/asf/camel/blob/b5c5c262/camel-core/src/main/java/org/apache/camel/component/bean/ParameterBindingException.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/ParameterBindingException.java b/camel-core/src/main/java/org/apache/camel/component/bean/ParameterBindingException.java
new file mode 100644
index 0000000..f59bdeb
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/ParameterBindingException.java
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bean;
+
+import java.lang.reflect.Method;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.util.ObjectHelper;
+
+public class ParameterBindingException extends RuntimeCamelException {
+
+    private Method method;
+    private int index;
+    private Class<?> parameterType;
+    private Object parameterValue;
+
+    public ParameterBindingException(Throwable cause, Method method, int index, Class<?> parameterType, Object parameterValue) {
+        super(createMessage(method, index, parameterType, parameterValue), cause);
+        this.method = method;
+        this.index = index;
+        this.parameterType = parameterType;
+        this.parameterValue = parameterValue;
+    }
+
+    public Method getMethod() {
+        return method;
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    public Class<?> getParameterType() {
+        return parameterType;
+    }
+
+    public Object getParameterValue() {
+        return parameterValue;
+    }
+
+    private static String createMessage(Method method, int index, Class<?> parameterType, Object parameterValue) {
+        return "Error during parameter binding on method: " + method + " at parameter #" + index + " with type: " + parameterType
+                + " with value type: " + ObjectHelper.type(parameterValue) + " and value: " + parameterValue;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b5c5c262/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithEmptyParameterAndNoMethodWithNoParameterIssueTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithEmptyParameterAndNoMethodWithNoParameterIssueTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithEmptyParameterAndNoMethodWithNoParameterIssueTest.java
index 45c0292..3058eb8 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithEmptyParameterAndNoMethodWithNoParameterIssueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithEmptyParameterAndNoMethodWithNoParameterIssueTest.java
@@ -26,6 +26,8 @@ import org.apache.camel.impl.JndiRegistry;
  */
 public class BeanMethodWithEmptyParameterAndNoMethodWithNoParameterIssueTest extends ContextTestSupport {
 
+    // TODO: CAMEL-6455
+
     @Override
     protected JndiRegistry createRegistry() throws Exception {
         JndiRegistry jndi = super.createRegistry();
@@ -48,7 +50,7 @@ public class BeanMethodWithEmptyParameterAndNoMethodWithNoParameterIssueTest ext
             @Override
             public void configure() throws Exception {
                 from("direct:start")
-                    .to("bean:myBean?method=doSomething()")
+                    .to("bean:myBean?method=doSomething(*)")
                     .to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/b5c5c262/camel-core/src/test/java/org/apache/camel/component/bean/BeanNoTypeConvertionPossibleWhenHeaderTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanNoTypeConvertionPossibleWhenHeaderTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanNoTypeConvertionPossibleWhenHeaderTest.java
index 8faca46..1f3f5b4 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanNoTypeConvertionPossibleWhenHeaderTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanNoTypeConvertionPossibleWhenHeaderTest.java
@@ -38,7 +38,12 @@ public class BeanNoTypeConvertionPossibleWhenHeaderTest extends ContextTestSuppo
             template.requestBodyAndHeader("direct:start", "Hello World", "foo", 555);
             fail("Should have thrown an exception");
         } catch (CamelExecutionException e) {
-            NoTypeConversionAvailableException ntae = assertIsInstanceOf(NoTypeConversionAvailableException.class, e.getCause());
+            ParameterBindingException pbe = assertIsInstanceOf(ParameterBindingException.class, e.getCause());
+            assertEquals(1, pbe.getIndex());
+            assertTrue(pbe.getMethod().getName().contains("hello"));
+            assertEquals(555, pbe.getParameterValue());
+
+            NoTypeConversionAvailableException ntae = assertIsInstanceOf(NoTypeConversionAvailableException.class, e.getCause().getCause());
             assertEquals(Integer.class, ntae.getFromType());
             assertEquals(Document.class, ntae.getToType());
             assertEquals(555, ntae.getValue());

http://git-wip-us.apache.org/repos/asf/camel/blob/b5c5c262/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadedMethodFQNTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadedMethodFQNTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadedMethodFQNTest.java
index 3b53add..bf202f6 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadedMethodFQNTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadedMethodFQNTest.java
@@ -66,7 +66,7 @@ public class BeanOverloadedMethodFQNTest extends ContextTestSupport {
             template.sendBody("direct:start", new MyOrder());
             fail("Should have thrown an exception");
         } catch (CamelExecutionException e) {
-            NoTypeConversionAvailableException cause = assertIsInstanceOf(NoTypeConversionAvailableException.class, e.getCause());
+            NoTypeConversionAvailableException cause = assertIsInstanceOf(NoTypeConversionAvailableException.class, e.getCause().getCause());
             assertEquals("Unknown", cause.getValue());
         }
     }
@@ -125,7 +125,7 @@ public class BeanOverloadedMethodFQNTest extends ContextTestSupport {
             template.sendBody("direct:start", new MyOrder());
             fail("Should have thrown an exception");
         } catch (CamelExecutionException e) {
-            NoTypeConversionAvailableException cause = assertIsInstanceOf(NoTypeConversionAvailableException.class, e.getCause());
+            NoTypeConversionAvailableException cause = assertIsInstanceOf(NoTypeConversionAvailableException.class, e.getCause().getCause());
             assertEquals("org.apache.camel.component.bean.BeanOverloadedMethodFQNTest$Unknown", cause.getValue());
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/b5c5c262/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java
index 416742b..c9a72e1 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java
@@ -37,7 +37,7 @@ public class BeanParameterInvalidValueTest extends ContextTestSupport {
             template.sendBody("direct:a", "World");
             fail("Should have thrown exception");
         } catch (CamelExecutionException e) {
-            TypeConversionException cause = assertIsInstanceOf(TypeConversionException.class, e.getCause());
+            TypeConversionException cause = assertIsInstanceOf(TypeConversionException.class, e.getCause().getCause());
             assertEquals(String.class, cause.getFromType());
             assertEquals(int.class, cause.getToType());
             assertEquals("A", cause.getValue());
@@ -53,7 +53,7 @@ public class BeanParameterInvalidValueTest extends ContextTestSupport {
             template.sendBody("direct:b", "World");
             fail("Should have thrown exception");
         } catch (CamelExecutionException e) {
-            TypeConversionException cause = assertIsInstanceOf(TypeConversionException.class, e.getCause());
+            TypeConversionException cause = assertIsInstanceOf(TypeConversionException.class, e.getCause().getCause());
             assertEquals(String.class, cause.getFromType());
             assertEquals(int.class, cause.getToType());
             assertEquals("true", cause.getValue());