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 2012/04/16 04:57:17 UTC
svn commit: r1326469 -
/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
Author: ningjiang
Date: Mon Apr 16 02:57:17 2012
New Revision: 1326469
URL: http://svn.apache.org/viewvc?rev=1326469&view=rev
Log:
CAMEL-5176 CxfProducer should not always leverage the toList type converter to find out the parameters for invocation
Modified:
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=1326469&r1=1326468&r2=1326469&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Mon Apr 16 02:57:17 2012
@@ -274,21 +274,24 @@ public class CxfProducer extends Default
Object[] params = null;
if (endpoint.getDataFormat() == DataFormat.POJO) {
- List<?> list = exchange.getIn().getBody(List.class);
- if (list != null) {
- params = list.toArray();
+ Object body = exchange.getIn().getBody();
+ if (body instanceof Object[]) {
+ params = (Object[])body;
+ } else if (body instanceof List) {
+ // Now we just check if the request is List
+ params = ((List<?>)body).toArray();
} else {
// maybe we can iterate the body and that way create a list for the parameters
// then end users do not need to trouble with List
Iterator<?> it = exchange.getIn().getBody(Iterator.class);
if (it != null && it.hasNext()) {
- list = exchange.getContext().getTypeConverter().convertTo(List.class, it);
+ List<?> list = exchange.getContext().getTypeConverter().convertTo(List.class, it);
if (list != null) {
params = list.toArray();
}
}
if (params == null) {
- // no we could not then use the body as single parameter
+ // now we just use the body as single parameter
params = new Object[1];
params[0] = exchange.getIn().getBody();
}