Author: ay
Date: Fri Feb 17 14:35:36 2012
New Revision: 1245573

URL: http://svn.apache.org/viewvc?rev=1245573&view=rev
Log:
Merged revisions 1245572 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1245572 | ay | 2012-02-17 15:31:34 +0100 (Fri, 17 Feb 2012) | 1 line
  
  [CXF-4023] invalid ProtocolVariant causes NullPointerException in 
RMSoapInterceptor
........

Added:
    
cxf/branches/2.5.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProtocolVariationTest.java
      - copied unchanged from r1245572, 
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProtocolVariationTest.java
Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    
cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
    
cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 17 14:35:36 2012
@@ -1 +1 @@
-/cxf/trunk:1244697,1244821,1244939,1245070
+/cxf/trunk:1244697,1244821,1244939,1245070,1245572

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java?rev=1245573&r1=1245572&r2=1245573&view=diff
==============================================================================
--- 
cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
 (original)
+++ 
cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
 Fri Feb 17 14:35:36 2012
@@ -283,11 +283,11 @@ public class RMSoapInterceptor extends A
                                 wsauri = maps.getNamespaceURI();
                             }
                             ProtocolVariation protocol = 
ProtocolVariation.findVariant(rmUri, wsauri);
-                            codec = protocol.getCodec();
-                            if (codec == null) {
+                            if (protocol == null) {
                                 LOG.log(Level.WARNING, "NAMESPACE_ERROR_MSG", 
wsauri); 
                                 break;
                             }
+                            codec = protocol.getCodec();
                         }
                         String localName = elem.getLocalName();
                         LOG.log(Level.FINE, "decoding RM header {0}", 
localName);

Modified: 
cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java?rev=1245573&r1=1245572&r2=1245573&view=diff
==============================================================================
--- 
cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java
 (original)
+++ 
cxf/branches/2.5.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java
 Fri Feb 17 14:35:36 2012
@@ -50,6 +50,7 @@ import org.apache.cxf.ws.addressing.Vers
 import org.apache.cxf.ws.rm.RM10Constants;
 import org.apache.cxf.ws.rm.RM11Constants;
 import org.apache.cxf.ws.rm.RMConstants;
+import org.apache.cxf.ws.rm.RMException;
 import org.apache.cxf.ws.rm.RMManager;
 
 import org.junit.After;
@@ -162,6 +163,29 @@ public class ProtocolVariationsTest exte
     }
     
     @Test
+    public void testInvalidRM11WSA200408() throws Exception {
+        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false);
+        
+        // WS-RM 1.1, but using the WS-A 1.0 namespace
+        Client client = ClientProxy.getClient(greeter);
+        client.getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, 
RM11Constants.NAMESPACE_URI);
+        client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, 
Names200408.WSA_NAMESPACE_NAME);
+
+        try {
+            greeter.greetMe("one");
+            fail("invalid namespace combination");
+        } catch (Exception e) {
+            assertTrue(e.getCause() instanceof RMException);
+            // verify a partial error text match to exclude an unexpected 
exception
+            // (see UNSUPPORTED_NAMESPACE in Messages.properties)
+            final String text = Names200408.WSA_NAMESPACE_NAME + " is not 
supported";
+            assertTrue(e.getCause().getMessage() != null 
+                       && e.getCause().getMessage().indexOf(text) > 0);
+        }
+        
+    }
+    
+    @Test
     public void testDefaultDecoupled() throws Exception {
         init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", true);
 


Reply via email to