You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/07/26 04:31:33 UTC

svn commit: r1150972 - in /cxf/branches/2.4.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/service/factory/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/

Author: dkulp
Date: Tue Jul 26 02:31:32 2011
New Revision: 1150972

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

........
  r1150971 | dkulp | 2011-07-25 22:29:43 -0400 (Mon, 25 Jul 2011) | 1 line
  
  [CXF-3668] Fix issue with duplicate Poclies added in Java-First approach
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
    cxf/branches/2.4.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
    cxf/branches/2.4.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java

Propchange: cxf/branches/2.4.x-fixes/
            ('svn:mergeinfo' removed)

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

Modified: cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java?rev=1150972&r1=1150971&r2=1150972&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java (original)
+++ cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java Tue Jul 26 02:31:32 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/branches/2.4.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?rev=1150972&r1=1150971&r2=1150972&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (original)
+++ cxf/branches/2.4.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Tue Jul 26 02:31:32 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/branches/2.4.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java?rev=1150972&r1=1150971&r2=1150972&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java (original)
+++ cxf/branches/2.4.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java Tue Jul 26 02:31:32 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,