You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2007/10/21 11:26:24 UTC

svn commit: r586878 - /incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java

Author: svkrish
Date: Sun Oct 21 02:26:16 2007
New Revision: 586878

URL: http://svn.apache.org/viewvc?rev=586878&view=rev
Log:
fix for not creating namespace element when ns is null

Modified:
    incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java

Modified: incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java?rev=586878&r1=586877&r2=586878&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java Sun Oct 21 02:26:16 2007
@@ -37,6 +37,7 @@
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
 import org.apache.neethi.PolicyEngine;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
@@ -288,6 +289,7 @@
         OMFactory fac = OMAbstractFactory.getOMFactory();
         OMElement head = fac.createOMElement(reader.getName());
         OMElement current = head;
+        
         while (true) {
             switch (reader.next()) {
                 case XMLStreamConstants.START_ELEMENT:
@@ -308,12 +310,17 @@
                     // add the attributes for this element
                     count = reader.getAttributeCount();
                     for (int i = 0; i < count; i++) {
+                        OMNamespace omNs = null;
                         String ns = reader.getAttributeNamespace(i);
                         String prefix = reader.getAttributePrefix(i);
                         String qname = reader.getAttributeLocalName(i);
                         String value = reader.getAttributeValue(i);
                         
-                        child.addAttribute(qname, value, fac.createOMNamespace(ns, prefix));
+                        if ( ns != null ) {
+                            omNs = fac.createOMNamespace(ns, prefix);
+                        }
+                            
+                        child.addAttribute(qname, value, omNs);
                         if (ns != null) {
                             child.declareNamespace(ns, prefix);
                         }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org