summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly-xml/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-09-03 12:54:04 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-09-03 12:54:04 +0000
commitd6484fcf1ccf4fb497001f060fdaed805b9d5e73 (patch)
treefd42ab1278527985f1fddf5b8cdf3e1cdc507898 /sca-java-2.x/trunk/modules/assembly-xml/src/main
parent62d5e37461b84c52c6b40ea681bad90d375722b8 (diff)
Avoid NPE in test cases. Encountered when writing out the system definitions file to XML.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@992280 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly-xml/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
index 68475a208b..6bf797d957 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
@@ -359,8 +359,14 @@ public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StA
writer.writeStartElement(SCA11_NS, POLICY_SET);
writer.writeNamespace(policySet.getName().getPrefix(), policySet.getName().getNamespaceURI());
writer.writeAttribute(NAME, policySet.getName().getPrefix() + COLON + policySet.getName().getLocalPart());
- writer.writeAttribute(APPLIES_TO, policySet.getAppliesTo());
- writer.writeAttribute(ATTACH_TO, policySet.getAttachTo());
+
+ if (policySet.getAppliesTo() != null){
+ writer.writeAttribute(APPLIES_TO, policySet.getAppliesTo());
+ }
+
+ if (policySet.getAttachTo() != null){
+ writer.writeAttribute(ATTACH_TO, policySet.getAttachTo());
+ }
writeProvidedIntents(policySet, writer);