Author: ningjiang
Date: Mon Aug 13 03:39:26 2012
New Revision: 1372254
URL: http://svn.apache.org/viewvc?rev=1372254&view=rev
Log:
Merged revisions 1372249 via svnmerge from
https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x
........
r1372249 | ningjiang | 2012-08-13 11:11:52 +0800 (Mon, 13 Aug 2012) | 2 lines
CAMEL-5499 Fixed the Cxf fallback converter issue of return null instead of
Void.value
........
Modified:
camel/branches/camel-2.9.x/ (props changed)
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java
camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1371967,1372244-1372245
Merged /camel/branches/camel-2.10.x:r1372249
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java?rev=1372254&r1=1372253&r2=1372254&view=diff
==============================================================================
---
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
(original)
+++
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
Mon Aug 13 03:39:26 2012
@@ -153,7 +153,8 @@ public final class CxfConverter {
// CXF-WS MessageContentsList class
if (MessageContentsList.class.isAssignableFrom(value.getClass())) {
MessageContentsList list = (MessageContentsList)value;
-
+
+ // try to turn the first array element into the object that we want
for (Object embedded : list) {
if (embedded != null) {
if (type.isInstance(embedded)) {
@@ -161,7 +162,12 @@ public final class CxfConverter {
} else {
TypeConverter tc = registry.lookup(type,
embedded.getClass());
if (tc != null) {
- return tc.convertTo(type, exchange, embedded);
+ Object result = tc.convertTo(type, exchange,
embedded);
+ if (result != null) {
+ return (T)result;
+ }
+ // there is no suitable result will be return
+ break;
}
}
}
Modified:
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java?rev=1372254&r1=1372253&r2=1372254&view=diff
==============================================================================
---
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java
(original)
+++
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java
Mon Aug 13 03:39:26 2012
@@ -169,8 +169,15 @@ public final class CxfPayloadConverter {
}
}
TypeConverter tc = registry.lookup(type, NodeList.class);
- if (tc != null) {
- return tc.convertTo(type, cxfPayloadToNodeList((CxfPayload<?>)
value, exchange));
+ if (tc != null) {
+ Object result = tc.convertTo(type,
cxfPayloadToNodeList((CxfPayload<?>) value, exchange));
+ if (result == null) {
+ // no we could not do it currently, and we just abort the
convert here
+ return (T) Void.TYPE;
+ } else {
+ return (T) result;
+ }
+
}
// we cannot convert a node list, so we try the first item from the
// node list
Modified:
camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java?rev=1372254&r1=1372253&r2=1372254&view=diff
==============================================================================
---
camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java
(original)
+++
camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java
Mon Aug 13 03:39:26 2012
@@ -59,7 +59,6 @@ public class CxfConsumerProviderTest ext
from(getFromEndpointUri()).process(new Processor() {
public void process(final Exchange exchange) {
Message in = exchange.getIn();
- // Get the parameter list
Node node = in.getBody(Node.class);
assertNotNull(node);
XmlConverter xmlConverter = new XmlConverter();
@@ -80,7 +79,7 @@ public class CxfConsumerProviderTest ext
assertTrue("Get a wrong response ",
response.startsWith(RESPONSE_MESSAGE_BEGINE));
assertTrue("Get a wrong response ",
response.endsWith(RESPONSE_MESSAGE_END));
try {
- response = template.requestBody(simpleEndpointAddress, null,
String.class);
+ template.requestBody(simpleEndpointAddress, null, String.class);
fail("Excpetion to get exception here");
} catch (Exception ex) {
// do nothing here