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 A0DC0E07D for ; Wed, 13 Feb 2013 17:09:29 +0000 (UTC) Received: (qmail 45984 invoked by uid 500); 13 Feb 2013 17:09:29 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 45929 invoked by uid 500); 13 Feb 2013 17:09:29 -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 45922 invoked by uid 99); 13 Feb 2013 17:09:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Feb 2013 17:09:29 +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; Wed, 13 Feb 2013 17:09:26 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7A8C52388ABC; Wed, 13 Feb 2013 17:09:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1445745 - in /cxf/branches/2.5.x-fixes/rt/ws/policy/src: main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java Date: Wed, 13 Feb 2013 17:09:06 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130213170906.7A8C52388ABC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Wed Feb 13 17:09:05 2013 New Revision: 1445745 URL: http://svn.apache.org/r1445745 Log: Merged revisions 1445711 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes ........ r1445711 | dkulp | 2013-02-13 11:26:34 -0500 (Wed, 13 Feb 2013) | 18 lines Merged revisions 1445375 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes ........ r1445375 | dkulp | 2013-02-12 16:15:57 -0500 (Tue, 12 Feb 2013) | 10 lines Merged revisions 1444957 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1444957 | dkulp | 2013-02-11 15:47:16 -0500 (Mon, 11 Feb 2013) | 2 lines Returning null matches the other providers and can avoid some expensive merges ........ ........ ........ Modified: cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java cxf/branches/2.5.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java Modified: cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java?rev=1445745&r1=1445744&r2=1445745&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java Wed Feb 13 17:09:05 2013 @@ -83,9 +83,12 @@ public class ExternalAttachmentProvider public Policy getEffectivePolicy(BindingFaultInfo bfi) { readDocument(); - Policy p = new Policy(); + Policy p = null; for (PolicyAttachment pa : attachments) { if (pa.appliesTo(bfi)) { + if (p == null) { + p = new Policy(); + } p = p.merge(pa.getPolicy()); } } @@ -95,21 +98,26 @@ public class ExternalAttachmentProvider public Policy getEffectivePolicy(BindingMessageInfo bmi) { readDocument(); - Policy p = new Policy(); + Policy p = null; for (PolicyAttachment pa : attachments) { if (pa.appliesTo(bmi)) { + if (p == null) { + p = new Policy(); + } p = p.merge(pa.getPolicy()); } } - return p; } public Policy getEffectivePolicy(BindingOperationInfo boi) { readDocument(); - Policy p = new Policy(); + Policy p = null; for (PolicyAttachment pa : attachments) { if (pa.appliesTo(boi)) { + if (p == null) { + p = new Policy(); + } p = p.merge(pa.getPolicy()); } } @@ -119,9 +127,12 @@ public class ExternalAttachmentProvider public Policy getEffectivePolicy(EndpointInfo ei) { readDocument(); - Policy p = new Policy(); + Policy p = null; for (PolicyAttachment pa : attachments) { if (pa.appliesTo(ei)) { + if (p == null) { + p = new Policy(); + } p = p.merge(pa.getPolicy()); } } @@ -131,9 +142,12 @@ public class ExternalAttachmentProvider public Policy getEffectivePolicy(ServiceInfo si) { readDocument(); - Policy p = new Policy(); + Policy p = null; for (PolicyAttachment pa : attachments) { if (pa.appliesTo(si)) { + if (p == null) { + p = new Policy(); + } p = p.merge(pa.getPolicy()); } } Modified: cxf/branches/2.5.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java?rev=1445745&r1=1445744&r2=1445745&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java Wed Feb 13 17:09:05 2013 @@ -84,7 +84,7 @@ public class ExternalAttachmentProviderT BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class); setUpAttachment(bfi, false, eap); control.replay(); - assertTrue(eap.getEffectivePolicy(bfi).isEmpty()); + assertNull(eap.getEffectivePolicy(bfi)); control.verify(); control.reset(); @@ -100,7 +100,7 @@ public class ExternalAttachmentProviderT BindingMessageInfo bmi = control.createMock(BindingMessageInfo.class); setUpAttachment(bmi, false, eap); control.replay(); - assertTrue(eap.getEffectivePolicy(bmi).isEmpty()); + assertNull(eap.getEffectivePolicy(bmi)); control.verify(); control.reset(); @@ -116,7 +116,7 @@ public class ExternalAttachmentProviderT ExternalAttachmentProvider eap = new ExternalAttachmentProvider(); setUpAttachment(boi, false, eap); control.replay(); - assertTrue(eap.getEffectivePolicy(boi).isEmpty()); + assertNull(eap.getEffectivePolicy(boi)); control.verify(); control.reset(); @@ -132,7 +132,7 @@ public class ExternalAttachmentProviderT EndpointInfo ei = control.createMock(EndpointInfo.class); setUpAttachment(ei, false, eap); control.replay(); - assertTrue(eap.getEffectivePolicy(ei).isEmpty()); + assertNull(eap.getEffectivePolicy(ei)); control.verify(); control.reset(); @@ -148,7 +148,7 @@ public class ExternalAttachmentProviderT ServiceInfo si = control.createMock(ServiceInfo.class); setUpAttachment(si, false, eap); control.replay(); - assertTrue(eap.getEffectivePolicy(si).isEmpty()); + assertNull(eap.getEffectivePolicy(si)); control.verify(); control.reset();