Author: scheu
Date: Wed Jul 26 14:20:35 2006
New Revision: 425842

URL: http://svn.apache.org/viewvc?rev=425842&view=rev
Log:
AXIS2-933
Minor fix to OMSerializerUtil + enablement of test

Modified:
    
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilder.java
    
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/util/OMSerializerUtil.java
    
webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/NamespaceTest.java

Modified: 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilder.java?rev=425842&r1=425841&r2=425842&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilder.java
 Wed Jul 26 14:20:35 2006
@@ -138,6 +138,12 @@
                 e.setFirstChild(node);
             }
 
+            
+            // This code seems suspicious.  The constructNode call
+            // does the attribute processing.  The parser is now at a 
different node,
+            // and thus processAttributes will either throw an exception or 
get the
+            // wrong attributes. (scheu)
+            
             // fill in the attributes
             processAttributes(node);
             //TODO Exception when trying to log . check this

Modified: 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/util/OMSerializerUtil.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/util/OMSerializerUtil.java?rev=425842&r1=425841&r2=425842&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/util/OMSerializerUtil.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/util/OMSerializerUtil.java
 Wed Jul 26 14:20:35 2006
@@ -321,8 +321,12 @@
                }
                prefix = (prefix != null && prefix.length() == 0) ? null : 
prefix;
                namespace = (namespace != null && namespace.length() == 0) ? 
null : namespace;
-               if (prefix != null && namespace != null) {
-                       writer.writeNamespace(prefix, namespace);
+               if (prefix != null) {
+                       // For some reason, prefixes are sometimes bound to an 
empty namespace on the OMElement.
+                       // This does not seem correct, the following code is a 
safeguard against errors.
+                       if (namespace != null) {
+                               writer.writeNamespace(prefix, namespace);
+                       }
                } else {
                        writer.writeDefaultNamespace(namespace);
                }

Modified: 
webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/NamespaceTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/NamespaceTest.java?rev=425842&r1=425841&r2=425842&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/NamespaceTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/NamespaceTest.java
 Wed Jul 26 14:20:35 2006
@@ -187,33 +187,33 @@
         return count;
     }
 
-//    public void testNamespaceProblem6() {
-//        OMFactory fac = OMAbstractFactory.getOMFactory();
-//        //TODO: Find the constants for "Parameter" and "name"
-//        OMElement paramElement = fac.createOMElement("Parameter", null);
-//        OMNamespace ns = paramElement.declareDefaultNamespace("");
-//        paramElement.addAttribute(fac.createOMAttribute("name", null, 
"someName"));
-//
-//
-//        for (int i = 0; i < 5; i++) {
-//            // Create the action element
-//            OMElement actionElem = fac.createOMElement(
-//                    "Action", ns);
-//
-//            for (int j = 0; j < 5; j++) {
-//                // Create an element with the name of the key
-//                OMElement elem = fac.createOMElement("someKey"+j, ns);
-//                // Set the text value of the element
-//                elem.setText("someValue"+j);
-//                // Add the element as a child of this action element
-//                actionElem.addChild(elem);
-//            }
-//
-//            paramElement.addChild(actionElem);
-//        }
-//
-//        System.out.println("paramElement = " + paramElement);
-//    }
+    public void testNamespaceProblem6() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        //TODO: Find the constants for "Parameter" and "name"
+        OMElement paramElement = fac.createOMElement("Parameter", null);
+        OMNamespace ns = paramElement.declareDefaultNamespace("");
+        paramElement.addAttribute(fac.createOMAttribute("name", null, 
"someName"));
+
+
+        for (int i = 0; i < 5; i++) {
+            // Create the action element
+            OMElement actionElem = fac.createOMElement(
+                    "Action", ns);
+
+            for (int j = 0; j < 5; j++) {
+                // Create an element with the name of the key
+                OMElement elem = fac.createOMElement("someKey"+j, ns);
+                // Set the text value of the element
+                elem.setText("someValue"+j);
+                // Add the element as a child of this action element
+                actionElem.addChild(elem);
+            }
+
+            paramElement.addChild(actionElem);
+        }
+
+        System.out.println("paramElement = " + paramElement);
+    }
 
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to