Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2E91AD751 for ; Fri, 15 Feb 2013 16:05:54 +0000 (UTC) Received: (qmail 85288 invoked by uid 500); 15 Feb 2013 16:05:53 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 85227 invoked by uid 500); 15 Feb 2013 16:05:53 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 85209 invoked by uid 99); 15 Feb 2013 16:05:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Feb 2013 16:05:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Feb 2013 16:05:50 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id ED59D238896F; Fri, 15 Feb 2013 16:05:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1446658 - /cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java Date: Fri, 15 Feb 2013 16:05:30 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130215160530.ED59D238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Fri Feb 15 16:05:30 2013 New Revision: 1446658 URL: http://svn.apache.org/r1446658 Log: Check if a policy is already registered to avoid a bunch of duplicates. Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java?rev=1446658&r1=1446657&r2=1446658&view=diff ============================================================================== --- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java (original) +++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java Fri Feb 15 16:05:30 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()); } } }