cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1388911 - in /cxf/trunk/rt/ws/rm/src/main: java/org/apache/cxf/ws/rm/policy/RM10PolicyUtils.java resources/META-INF/cxf/bus-extensions.txt resources/META-INF/cxf/cxf-extension-rm.xml
Date Sat, 22 Sep 2012 22:15:01 GMT
Author: ay
Date: Sat Sep 22 22:15:01 2012
New Revision: 1388911

URL: http://svn.apache.org/viewvc?rev=1388911&view=rev
Log:
[CXF-4517] ClassCastException in WS-RM when RMP 200702 assertions are used

Modified:
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10PolicyUtils.java
    cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt
    cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10PolicyUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10PolicyUtils.java?rev=1388911&r1=1388910&r2=1388911&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10PolicyUtils.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10PolicyUtils.java Sat
Sep 22 22:15:01 2012
@@ -21,7 +21,9 @@ package org.apache.cxf.ws.rm.policy;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.logging.Logger;
 
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.policy.AssertionInfo;
 import org.apache.cxf.ws.policy.AssertionInfoMap;
@@ -37,6 +39,7 @@ import org.apache.cxf.ws.rmp.v200502.RMA
  * 
  */
 public final class RM10PolicyUtils {
+    private static final Logger LOG = LogUtils.getL7dLogger(RM10PolicyUtils.class); 
     
     /**
      * Prevents instantiation.
@@ -58,6 +61,8 @@ public final class RM10PolicyUtils {
             if (ais != null) {
                 mergedAsserts.addAll(ais);
             }
+
+            //REVISIT this class shouldn't be picking RMP200702 assertions (see below)
             ais = aim.get(RM11Constants.WSRMP_RMASSERTION_QNAME);
             if (ais != null) {
                 mergedAsserts.addAll(ais);
@@ -78,9 +83,15 @@ public final class RM10PolicyUtils {
         RMAssertion compatible = defaultValue;
         Collection<AssertionInfo> ais = collectRMAssertions(message.get(AssertionInfoMap.class));
         for (AssertionInfo ai : ais) {
-            JaxbAssertion<RMAssertion> ja = getAssertion(ai);
-            RMAssertion rma = ja.getData();
-            compatible = null == defaultValue ? rma : intersect(compatible, rma);
+            //REVISIT this class can't handle RMP200702 assertions, so guard against CCE

+            if (ai.getAssertion() instanceof JaxbAssertion 
+                && ((JaxbAssertion<?>)ai.getAssertion()).getData() instanceof
RMAssertion) {
+                JaxbAssertion<RMAssertion> ja = getAssertion(ai);
+                RMAssertion rma = (RMAssertion)ja.getData(); 
+                compatible = null == defaultValue ? rma : intersect(compatible, rma);
+            } else {
+                LOG.warning("Ignoring unexpected assertion class: " + ai.getAssertion());
+            }
         }
         return compatible;
     }

Modified: cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1388911&r1=1388910&r2=1388911&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt (original)
+++ cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt Sat Sep 22 22:15:01
2012
@@ -1,4 +1,5 @@
 org.apache.cxf.ws.rm.RMManager::true
 org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider::true:true
 org.apache.cxf.ws.rm.policy.RMAssertionBuilder::true:true
+org.apache.cxf.ws.rm.policy.RM11AssertionBuilder::true:true
 

Modified: cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml?rev=1388911&r1=1388910&r2=1388911&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml (original)
+++ cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml Sat Sep 22 22:15:01
2012
@@ -39,4 +39,9 @@ http://www.springframework.org/schema/be
         <constructor-arg ref="cxf"/>
         <constructor-arg value="org.apache.cxf.ws.rm.policy.RMAssertionBuilder"/>
     </bean>
+    <bean id="org.apache.cxf.ws.rm.policy.RM11AssertionBuilder"
+        class="org.apache.cxf.bus.spring.OldSpringSupport" lazy-init="true">
+        <constructor-arg ref="cxf"/>
+        <constructor-arg value="org.apache.cxf.ws.rm.policy.RM11AssertionBuilder"/>
+    </bean>
 </beans>
\ No newline at end of file



Mime
View raw message