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 2019/07/21 18:18:50 UTC
[camel] 09/11: CAMEL-13755: camel3 - Remove fault from
camel-core/message and let it be component specific for camel-cxf and
camel-spring-ws as its only used by SOAP-WS
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch CAMEL-13755
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 573c4a51ba9205ed62afa399c3da1c49b6c25143
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Jul 21 18:48:43 2019 +0200
CAMEL-13755: camel3 - Remove fault from camel-core/message and let it be component specific for camel-cxf and camel-spring-ws as its only used by SOAP-WS
---
.../java/org/apache/camel/component/cxf/CxfConsumer.java | 15 +++++++++++----
.../camel/main/parser/MyConfigurationParserTest.java | 2 +-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
index cad4692..34cb15a 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
@@ -325,14 +325,21 @@ public class CxfConsumer extends DefaultConsumer implements Suspendable {
}
private void checkFailure(org.apache.camel.Exchange camelExchange, Exchange cxfExchange) throws Fault {
- final Throwable t;
- if (camelExchange.isFailed()) {
- t = camelExchange.getException();
+ Throwable t = camelExchange.getException();
+ if (t == null) {
+ // SOAP faults can be stored as exceptions as message body (to be backwards compatible)
+ Object body = camelExchange.getMessage().getBody();
+ if (body instanceof Throwable) {
+ t = (Throwable) body;
+ }
+ }
+
+ if (t != null) {
cxfExchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
if (t instanceof Fault) {
cxfExchange.getInMessage().put(FaultMode.class, FaultMode.CHECKED_APPLICATION_FAULT);
throw (Fault)t;
- } else if (t != null) {
+ } else {
// This is not a CXF Fault. Build the CXF Fault manually.
Fault fault = new Fault(t);
if (fault.getMessage() == null) {
diff --git a/tooling/maven/camel-main-parser/src/test/java/org/apache/camel/main/parser/MyConfigurationParserTest.java b/tooling/maven/camel-main-parser/src/test/java/org/apache/camel/main/parser/MyConfigurationParserTest.java
index 7bbed12..7c5833e 100644
--- a/tooling/maven/camel-main-parser/src/test/java/org/apache/camel/main/parser/MyConfigurationParserTest.java
+++ b/tooling/maven/camel-main-parser/src/test/java/org/apache/camel/main/parser/MyConfigurationParserTest.java
@@ -30,7 +30,7 @@ public class MyConfigurationParserTest extends TestCase {
MainConfigurationParser parser = new MainConfigurationParser();
List<ConfigurationModel> list = parser.parseConfigurationSource(fileName);
assertNotNull(list);
- assertEquals(41, list.size());
+ assertEquals(40, list.size());
assertEquals("name", list.get(0).getName());
assertEquals("java.lang.String", list.get(0).getJavaType());