You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2011/03/07 06:28:43 UTC
Re: svn commit: r1078684 - in /camel/trunk/components/camel-cxf/src:
main/java/org/apache/camel/component/cxf/CxfEndpoint.java test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java
Hi Willem
You added by mistake this import which is not needed:
+import java.security.InvalidParameterException;
On Mon, Mar 7, 2011 at 5:43 AM, <ni...@apache.org> wrote:
> Author: ningjiang
> Date: Mon Mar 7 04:43:35 2011
> New Revision: 1078684
>
> URL: http://svn.apache.org/viewvc?rev=1078684&view=rev
> Log:
> CAMEL-3761 Throw exception when CXFProducer can't set right payload parameters according to the BindingOperationInfo
>
> Modified:
> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
> camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java
>
> Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1078684&r1=1078683&r2=1078684&view=diff
> ==============================================================================
> --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
> +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Mon Mar 7 04:43:35 2011
> @@ -17,6 +17,7 @@
> package org.apache.camel.component.cxf;
>
> import java.lang.reflect.Proxy;
> +import java.security.InvalidParameterException;
> import java.util.Collection;
> import java.util.List;
> import java.util.concurrent.atomic.AtomicBoolean;
> @@ -623,6 +624,11 @@ public class CxfEndpoint extends Default
> content.put(partInfo, elements.get(i++));
> }
> }
> +
> + if (content.size() < elements.size()) {
> + LOG.warn("Cannot set right payload paremeters. Please check the BindingOperation and PayLoadMessage.");
> + throw new IllegalArgumentException("The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage.");
> + }
>
> message.setContent(List.class, content);
> message.put(Header.HEADER_LIST, payload.getHeaders());
>
> Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java
> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java?rev=1078684&r1=1078683&r2=1078684&view=diff
> ==============================================================================
> --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java (original)
> +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java Mon Mar 7 04:43:35 2011
> @@ -139,6 +139,14 @@ public class CxfProducerRouterTest exten
> String response = out.getBody(String.class);
> assertTrue("It should has the echo message", response.indexOf("echo " + TEST_MESSAGE) > 0);
> assertTrue("It should has the echoResponse tag", response.indexOf("echoResponse") > 0);
> +
> + senderExchange = new DefaultExchange(context, ExchangePattern.InOut);
> + senderExchange.getIn().setBody(REQUEST_PAYLOAD);
> + // Don't specify operation information here
> + exchange = template.send("direct:EndpointC", senderExchange);
> +
> + assertNotNull("Expect exception here.", exchange.getException());
> + assertTrue(exchange.getException() instanceof IllegalArgumentException);
>
> }
>
>
>
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: svn commit: r1078684 - in /camel/trunk/components/camel-cxf/src:
main/java/org/apache/camel/component/cxf/CxfEndpoint.java test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java
Posted by Willem Jiang <wi...@gmail.com>.
Hi Claus,
Thanks for pointing that out, I just commit a quick fix for it.
Willem
On 3/7/11 1:28 PM, Claus Ibsen wrote:
> Hi Willem
>
> You added by mistake this import which is not needed:
> +import java.security.InvalidParameterException;
>
>
>
>
> On Mon, Mar 7, 2011 at 5:43 AM,<ni...@apache.org> wrote:
>> Author: ningjiang
>> Date: Mon Mar 7 04:43:35 2011
>> New Revision: 1078684
>>
>> URL: http://svn.apache.org/viewvc?rev=1078684&view=rev
>> Log:
>> CAMEL-3761 Throw exception when CXFProducer can't set right payload parameters according to the BindingOperationInfo
>>
>> Modified:
>> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
>> camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java
>>
>> Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
>> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1078684&r1=1078683&r2=1078684&view=diff
>> ==============================================================================
>> --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
>> +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Mon Mar 7 04:43:35 2011
>> @@ -17,6 +17,7 @@
>> package org.apache.camel.component.cxf;
>>
>> import java.lang.reflect.Proxy;
>> +import java.security.InvalidParameterException;
>> import java.util.Collection;
>> import java.util.List;
>> import java.util.concurrent.atomic.AtomicBoolean;
>> @@ -623,6 +624,11 @@ public class CxfEndpoint extends Default
>> content.put(partInfo, elements.get(i++));
>> }
>> }
>> +
>> + if (content.size()< elements.size()) {
>> + LOG.warn("Cannot set right payload paremeters. Please check the BindingOperation and PayLoadMessage.");
>> + throw new IllegalArgumentException("The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage.");
>> + }
>>
>> message.setContent(List.class, content);
>> message.put(Header.HEADER_LIST, payload.getHeaders());
>>
>> Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java
>> URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java?rev=1078684&r1=1078683&r2=1078684&view=diff
>> ==============================================================================
>> --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java (original)
>> +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java Mon Mar 7 04:43:35 2011
>> @@ -139,6 +139,14 @@ public class CxfProducerRouterTest exten
>> String response = out.getBody(String.class);
>> assertTrue("It should has the echo message", response.indexOf("echo " + TEST_MESSAGE)> 0);
>> assertTrue("It should has the echoResponse tag", response.indexOf("echoResponse")> 0);
>> +
>> + senderExchange = new DefaultExchange(context, ExchangePattern.InOut);
>> + senderExchange.getIn().setBody(REQUEST_PAYLOAD);
>> + // Don't specify operation information here
>> + exchange = template.send("direct:EndpointC", senderExchange);
>> +
>> + assertNotNull("Expect exception here.", exchange.getException());
>> + assertTrue(exchange.getException() instanceof IllegalArgumentException);
>>
>> }
>>
>>
>>
>>
>
>
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang