cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1150971 - in /cxf/trunk/rt: core/src/main/java/org/apache/cxf/service/factory/ ws/policy/src/main/java/org/apache/cxf/ws/policy/ ws/policy/src/test/java/org/apache/cxf/ws/policy/
Date Tue, 26 Jul 2011 02:29:43 GMT
Author: dkulp
Date: Tue Jul 26 02:29:43 2011
New Revision: 1150971

URL: http://svn.apache.org/viewvc?rev=1150971&view=rev
Log:
[CXF-3668] Fix issue with duplicate Poclies added in Java-First approach

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java?rev=1150971&r1=1150970&r2=1150971&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
Tue Jul 26 02:29:43 2011
@@ -35,7 +35,7 @@ import org.apache.cxf.configuration.Conf
 public class FactoryBeanListenerManager {
     Bus bus;
     
-    List<FactoryBeanListener> listeners
+    CopyOnWriteArrayList<FactoryBeanListener> listeners
         = new CopyOnWriteArrayList<FactoryBeanListener>();
     
     public FactoryBeanListenerManager() {
@@ -55,9 +55,7 @@ public class FactoryBeanListenerManager 
         ConfiguredBeanLocator loc = bus.getExtension(ConfiguredBeanLocator.class);
         if (loc != null) {
             for (FactoryBeanListener f : loc.getBeansOfType(FactoryBeanListener.class)) {
-                if (!listeners.contains(f)) {
-                    listeners.add(f);
-                }
+                listeners.addIfAbsent(f);
             }
         }
     }
@@ -67,7 +65,7 @@ public class FactoryBeanListenerManager 
     }
     
     public void addListener(FactoryBeanListener l) {
-        listeners.add(l);
+        listeners.addIfAbsent(l);
     }
     
     public void removeListener(FactoryBeanListener l) {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?rev=1150971&r1=1150970&r2=1150971&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Tue
Jul 26 02:29:43 2011
@@ -32,6 +32,7 @@ import org.apache.cxf.common.logging.Log
 import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.service.factory.FactoryBeanListener;
 import org.apache.cxf.service.factory.FactoryBeanListenerManager;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
@@ -105,6 +106,11 @@ public class PolicyEngineImpl implements
         addBusInterceptors();
         FactoryBeanListenerManager fblm = bus.getExtension(FactoryBeanListenerManager.class);
         if (fblm != null) {
+            for (FactoryBeanListener l : fblm.getListeners()) {
+                if (l instanceof PolicyAnnotationListener) {
+                    return;
+                }
+            }
             fblm.addListener(new PolicyAnnotationListener());
         }
     }

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java?rev=1150971&r1=1150970&r2=1150971&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java
(original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java
Tue Jul 26 02:29:43 2011
@@ -117,6 +117,8 @@ public class PolicyAnnotationTest extend
                    xpu.isExist("/wsdl:definitions/wsp:Policy[@wsu:Id='" + uri + "']",
                               wsdl,
                               XPathConstants.NODE));
+        assertEquals(1, xpu.getValueList("/wsdl:definitions/wsp:Policy[@wsu:Id='" + uri +
"']",
+                         wsdl).getLength());
         assertTrue(uri + " reference not found",
                xpu.isExist(path + "/wsp:PolicyReference[@URI='#" + uri + "']",
                           wsdl,



Mime
View raw message