cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1446667 - /cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
Date Fri, 15 Feb 2013 16:14:03 GMT
Author: dkulp
Date: Fri Feb 15 16:14:03 2013
New Revision: 1446667

URL: http://svn.apache.org/r1446667
Log:
Merged revisions 1446658 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1446658 | dkulp | 2013-02-15 11:05:30 -0500 (Fri, 15 Feb 2013) | 2 lines

  Check if a policy is already registered to avoid a bunch of duplicates.

........

Modified:
    cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java

Modified: cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java?rev=1446667&r1=1446666&r2=1446667&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
Fri Feb 15 16:14:03 2013
@@ -183,18 +183,20 @@ public class Wsdl11AttachmentPolicyProvi
                     
                     if (Constants.isPolicyElement(e.getElementType())
                         && !StringUtils.isEmpty(uri)) {
-                        try {
-                            Policy policy = builder.getPolicy(e.getElement());
-                            String fragement = "#" + uri;
-                            registry.register(fragement, policy);
-                            if (di.getBaseURI() == null) {
-                                registry.register(Integer.toString(di.hashCode()) + fragement,
policy);
-                            } else {
-                                registry.register(di.getBaseURI() + fragement, policy);
+                        
+                        String id = (di.getBaseURI() == null ? Integer.toString(di.hashCode())
: di.getBaseURI()) 
+                                + "#" + uri;
+                        Policy policy = registry.lookup(id);
+                        if (policy == null) {
+                            try {
+                                policy = builder.getPolicy(e.getElement());
+                                String fragement = "#" + uri;
+                                registry.register(fragement, policy);
+                                registry.register(id, policy);
+                            } catch (Exception policyEx) {
+                                //ignore the policy can not be built
+                                LOG.warning("Failed to build the policy '" + uri + "':" +
policyEx.getMessage());
                             }
-                        } catch (Exception policyEx) {
-                            //ignore the policy can not be built
-                            LOG.warning("Failed to build the policy '" + uri + "':" + policyEx.getMessage());
                         }
                     }
                 }



Mime
View raw message