This is an automated email from the ASF dual-hosted git repository. dkulp pushed a commit to branch camel-2.21.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9bb0bc7f58f4f8b34e37d382295c0d035dbfbdc1 Author: Daniel Kulp <dk...@apache.org> AuthorDate: Wed Jun 27 18:50:32 2018 +0200 CAMEL-12599 - refactor how CAMEL-12326 was handled to avoid a bunch of copy/paste from CXF --- .../apache/camel/component/cxf/CxfEndpoint.java | 81 ++-------------------- 1 file changed, 7 insertions(+), 74 deletions(-) diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java index 5a80cb1..c6d34f1 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java @@ -1176,85 +1176,18 @@ public class CxfEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade CamelCxfClientImpl(Bus bus, Endpoint ep) { super(bus, ep); } - - public Bus getBus() { - return bus; - } - + @Override protected Object[] processResult(Message message, org.apache.cxf.message.Exchange exchange, BindingOperationInfo oi, Map<String, Object> resContext) throws Exception { - Exception ex = null; - // Check to see if there is a Fault from the outgoing chain if it's an out Message - if (!message.get(Message.INBOUND_MESSAGE).equals(Boolean.TRUE)) { - ex = message.getContent(Exception.class); - } - boolean mepCompleteCalled = false; - if (ex != null) { - completeExchange(exchange); - mepCompleteCalled = true; - if (message.getContent(Exception.class) != null) { - throw ex; - } - } - ex = message.getExchange().get(Exception.class); - if (ex != null) { - if (!mepCompleteCalled) { - completeExchange(exchange); - } - throw ex; - } - - Integer responseCode = (Integer)exchange.get(Message.RESPONSE_CODE); - if (null != responseCode && 202 == responseCode) { - Endpoint ep = exchange.getEndpoint(); - if (null != ep && null != ep.getEndpointInfo() && null == ep.getEndpointInfo() - .getProperty("org.apache.cxf.ws.addressing.MAPAggregator.decoupledDestination")) { - return null; - } - } - - // Wait for a response if we need to - if (oi != null && !oi.getOperationInfo().isOneWay()) { - waitResponse(exchange); - } - - // leave the input stream open for the caller - Boolean keepConduitAlive = (Boolean)exchange.get(Client.KEEP_CONDUIT_ALIVE); - if (keepConduitAlive == null || !keepConduitAlive) { - completeExchange(exchange); - } - - // Grab the response objects if there are any - List<Object> resList = null; - Message inMsg = exchange.getInMessage(); - if (inMsg != null) { - if (null != resContext) { - resContext.putAll(inMsg); - // remove the recursive reference if present - resContext.remove(Message.INVOCATION_CONTEXT); - responseContext.put(Thread.currentThread(), resContext); - } - resList = CastUtils.cast(inMsg.getContent(List.class)); - } - - // check for an incoming fault - ex = getException(exchange); - - if (ex != null) { - throw ex; - } - - if (resList != null) { - return resList.toArray(); + try { + return super.processResult(message, exchange, oi, resContext); + } catch (IllegalEmptyResponseException ex) { + //Camel does not strickly enforce returning a value when a value is required from the WSDL/contract + //Thus, we'll capture the exception raised and return a null + return null; } - - return null; - } - - private void completeExchange(org.apache.cxf.message.Exchange exchange) { - getConduitSelector().complete(exchange); } @SuppressWarnings("unchecked")