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/12 22:15:58 UTC
svn commit: r1445375 - in /cxf/branches/2.7.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
Author: dkulp
Date: Tue Feb 12 21:15:57 2013
New Revision: 1445375
URL: http://svn.apache.org/r1445375
Log:
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.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
cxf/branches/2.7.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java
Modified: cxf/branches/2.7.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.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java?rev=1445375&r1=1445374&r2=1445375&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java Tue Feb 12 21:15:57 2013
@@ -81,9 +81,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());
}
}
@@ -93,21 +96,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());
}
}
@@ -117,9 +125,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());
}
}
@@ -129,9 +140,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.7.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.7.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java?rev=1445375&r1=1445374&r2=1445375&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java Tue Feb 12 21:15:57 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();