diff options
-rw-r--r-- | sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java index 1c958f70d4..c4dd9b4182 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java @@ -39,6 +39,7 @@ import org.apache.tuscany.sca.assembly.builder.BuilderContext; import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.definitions.Definitions; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.policy.PolicySubject; import org.w3c.dom.Document; @@ -67,6 +68,11 @@ public class PolicyAppliesToBuilderImpl extends PolicyAttachmentBuilderImpl { public Composite build(Composite composite, BuilderContext context) throws CompositeBuilderException { try { + + Definitions definitions = context.getDefinitions(); + if (definitions == null || (definitions.getPolicySets().isEmpty() && definitions.getExternalAttachments().isEmpty()) ) { + return composite; + } // create a DOM for the Domain Composite Infoset Document document = saveAsDOM(composite); |