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 2013/02/15 17:14:03 UTC
svn commit: r1446667 -
/cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
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());
}
}
}