Only save the composite into DOM if there is a policySet with attachTo

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@820166 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
rfeng 2009-09-30 03:49:07 +00:00
parent 391774bfc9
commit 482eff11e6

View file

@ -118,7 +118,7 @@ public class PolicyAttachmentBuilderImpl implements CompositeBuilder {
}
}
}
Document document = saveAsDOM(composite);
Document document = null;
for (PolicySet ps : definitions.getPolicySets()) {
// First calculate the applicable nodes
@ -135,6 +135,9 @@ public class PolicyAttachmentBuilderImpl implements CompositeBuilder {
*/
XPathExpression exp = ps.getAttachToXPathExpression();
if (exp != null) {
if (document == null) {
document = saveAsDOM(composite);
}
NodeList nodes = (NodeList)exp.evaluate(document, XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);