You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by as...@apache.org on 2014/02/20 14:17:22 UTC

git commit: [CXF-5571] Policy Alternative compatibility checking rely on not overriden equals() method

Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 79ed5e447 -> 09c7b2f67


[CXF-5571] Policy Alternative compatibility checking rely on not overriden equals() method


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/09c7b2f6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/09c7b2f6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/09c7b2f6

Branch: refs/heads/2.7.x-fixes
Commit: 09c7b2f670b62b3a4e4d8a700a8b44494bbdd662
Parents: 79ed5e4
Author: Andrei Shakirin <an...@gmail.com>
Authored: Thu Feb 20 12:53:37 2014 +0100
Committer: Andrei Shakirin <an...@gmail.com>
Committed: Thu Feb 20 14:16:51 2014 +0100

----------------------------------------------------------------------
 .../ws/policy/selector/BaseAlternativeSelector.java   | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/09c7b2f6/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/BaseAlternativeSelector.java
----------------------------------------------------------------------
diff --git a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/BaseAlternativeSelector.java b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/BaseAlternativeSelector.java
index c3dc6d0..40e51a0 100644
--- a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/BaseAlternativeSelector.java
+++ b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/BaseAlternativeSelector.java
@@ -23,6 +23,8 @@ package org.apache.cxf.ws.policy.selector;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.xml.namespace.QName;
+
 import org.apache.cxf.ws.policy.AlternativeSelector;
 import org.apache.neethi.Assertion;
 
@@ -46,12 +48,14 @@ public abstract class BaseAlternativeSelector implements AlternativeSelector {
     }
 
     protected boolean isCompatible(List<Assertion> alternative, List<Assertion> r) {
-        List<Assertion> r2 = new ArrayList<Assertion>(r);
+        // Workaround until Neethi assertions do not override equals()
+        List<QName> rNames = new ArrayList<QName>(r.size());
+        for (Assertion ra : r) {
+            rNames.add(ra.getName());
+        }
         for (Assertion a : alternative) {
-            r2.remove(a);
+            rNames.remove(a.getName());
         }
-        return r2.isEmpty();
+        return rNames.isEmpty();
     }
-    
-    
 }