Author: ay Date: Thu Apr 4 11:35:41 2013 New Revision: 1464464 URL: http://svn.apache.org/r1464464 Log: Merged revisions 1464451 via svn merge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
........ r1464451 | ay | 2013-04-04 13:23:40 +0200 (Thu, 04 Apr 2013) | 9 lines Merged revisions 1464110 via svn merge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1464110 | ay | 2013-04-03 19:10:12 +0200 (Wed, 03 Apr 2013) | 1 line [CXF-4941] WS-RM related faults do not contain the correct addressing action ........ ........ Modified: cxf/branches/2.6.x-fixes/ (props changed) cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java cxf/branches/2.6.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java cxf/branches/2.6.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java Propchange: cxf/branches/2.6.x-fixes/ ('svn:mergeinfo' removed) Propchange: cxf/branches/2.6.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java?rev=1464464&r1=1464463&r2=1464464&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java (original) +++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java Thu Apr 4 11:35:41 2013 @@ -88,8 +88,7 @@ public abstract class AbstractFaultChain faultMessage.put(FaultMode.class, mode); } //CXF-3981 - if (message.get("org.apache.cxf.ws.rm.inbound") == null - && message.get("javax.xml.ws.addressing.context.inbound") != null) { + if (message.get("javax.xml.ws.addressing.context.inbound") != null) { faultMessage.put("javax.xml.ws.addressing.context.inbound", message.get("javax.xml.ws.addressing.context.inbound")); } Modified: cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java?rev=1464464&r1=1464463&r2=1464464&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java (original) +++ cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java Thu Apr 4 11:35:41 2013 @@ -48,14 +48,13 @@ public class RMInInterceptor extends Abs @Override public void handleFault(Message message) { message.put(MAPAggregator.class.getName(), true); - if (null == RMContextUtils.getProtocolVariation(message)) { - return; - } if (MessageUtils.isTrue(message.get(RMMessageConstants.DELIVERING_ROBUST_ONEWAY))) { // revert the delivering entry from the destination sequence try { Destination destination = getManager().getDestination(message); - destination.releaseDeliveringStatus(message); + if (destination != null) { + destination.releaseDeliveringStatus(message); + } } catch (RMException e) { LOG.log(Level.WARNING, "Failed to revert the delivering status"); } @@ -115,7 +114,7 @@ public class RMInInterceptor extends Abs String addrUri = maps.getNamespaceURI(); ProtocolVariation protocol = ProtocolVariation.findVariant(rmUri, addrUri); - if (null == protocol) { + if (null == protocol && !MessageUtils.isFault(message)) { org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message( "WSRM_REQUIRED_EXC", LOG, rmUri, addrUri); LOG.log(Level.INFO, msg.toString()); Modified: cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java?rev=1464464&r1=1464463&r2=1464464&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java (original) +++ cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java Thu Apr 4 11:35:41 2013 @@ -59,23 +59,27 @@ public class RMOutInterceptor extends Ab } protected void handle(Message msg) throws SequenceFault, RMException { - if (isRuntimeFault(msg)) { - LogUtils.log(LOG, Level.WARNING, "RUNTIME_FAULT_MSG"); - // TODO: in case of a SequenceFault need to set action - // to http://schemas.xmlsoap.org/ws/2004/a08/addressing/fault - // but: need to defer propagation of received MAPS to outbound chain first - return; - } - AddressingProperties maps = ContextUtils.retrieveMAPs(msg, false, true, false); if (null == maps) { LogUtils.log(LOG, Level.WARNING, "MAPS_RETRIEVAL_FAILURE_MSG"); return; } - - Source source = getManager().getSource(msg); String rmUri = getManager().getRMNamespace(msg); String addrUri = getManager().getAddressingNamespace(msg); + if (isRuntimeFault(msg)) { + LogUtils.log(LOG, Level.WARNING, "RUNTIME_FAULT_MSG"); + // in case of a SequenceFault or other WS-RM related fault, set action appropriately. + // the received inbound maps is available to extract some values in case if needed. + Throwable cause = msg.getContent(Exception.class).getCause(); + if (cause instanceof SequenceFault || cause instanceof RMException) { + maps.getAction().setValue(RM11Constants.NAMESPACE_URI.equals(rmUri) + ? RM11Constants.NAMESPACE_URI + "/fault" + : addrUri + "/fault"); + } + return; + } + + Source source = getManager().getSource(msg); ProtocolVariation protocol = ProtocolVariation.findVariant(rmUri, addrUri); RMContextUtils.setProtocolVariation(msg, protocol); Modified: cxf/branches/2.6.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java?rev=1464464&r1=1464463&r2=1464464&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java (original) +++ cxf/branches/2.6.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java Thu Apr 4 11:35:41 2013 @@ -342,6 +342,8 @@ public class RMInInterceptorTest extends @Test public void testProcessInvalidMessageOnFault() throws SequenceFault, RMException { interceptor = new RMInInterceptor(); + manager = control.createMock(RMManager.class); + interceptor.setManager(manager); Message message = control.createMock(Message.class); Exchange exchange = control.createMock(Exchange.class); Modified: cxf/branches/2.6.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java?rev=1464464&r1=1464463&r2=1464464&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java (original) +++ cxf/branches/2.6.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java Thu Apr 4 11:35:41 2013 @@ -103,6 +103,8 @@ public class SequenceTest extends Abstra = "http://cxf.apache.org/greeter_control/Greeter/greetMeRequest"; private static final String GREETME_RESPONSE_ACTION = "http://cxf.apache.org/greeter_control/Greeter/greetMeResponse"; + private static final String RM10_GENERIC_FAULT_ACTION + = "http://schemas.xmlsoap.org/ws/2004/08/addressing/fault"; private static String decoupledEndpoint; private static int decoupledCount = 1; @@ -795,7 +797,7 @@ public class SequenceTest extends Abstra mf.verifyMessages(3, false); expectedActions = new String[] {RM10Constants.CREATE_SEQUENCE_RESPONSE_ACTION, GREETME_RESPONSE_ACTION, - null}; + RM10_GENERIC_FAULT_ACTION}; mf.verifyActions(expectedActions, false); mf.verifyMessageNumbers(new String[] {null, "1", null}, false); mf.verifyAcknowledgements(new boolean[3] , false); @@ -836,6 +838,10 @@ public class SequenceTest extends Abstra MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages(), Names200408.WSA_NAMESPACE_NAME, RM10Constants.NAMESPACE_URI); mf.verifySequenceFault(RM10Constants.UNKNOWN_SEQUENCE_FAULT_QNAME, false, 1); + String[] expectedActions = new String[3]; + expectedActions = new String[] {RM10Constants.CREATE_SEQUENCE_RESPONSE_ACTION, + RM10_GENERIC_FAULT_ACTION}; + mf.verifyActions(expectedActions, false); } @Test @@ -888,7 +894,7 @@ public class SequenceTest extends Abstra mf.verifyMessages(3, false); expectedActions = new String[] {RM10Constants.CREATE_SEQUENCE_RESPONSE_ACTION, GREETME_RESPONSE_ACTION, - null}; + RM10_GENERIC_FAULT_ACTION}; mf.verifyActions(expectedActions, false); mf.verifyMessageNumbers(new String[] {null, "1", null}, false); mf.verifyAcknowledgements(new boolean[] {false, true, false} , false);
