ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1700273 - in /webservices/axiom/trunk: aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/ implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ systests/old-tests/src/test/java/org/apache/axiom/soap/impl/llom/
Date Mon, 31 Aug 2015 16:29:33 GMT
Author: veithen
Date: Mon Aug 31 16:29:32 2015
New Revision: 1700273

URL: http://svn.apache.org/r1700273
Log:
Increase code reuse, fix some more namespace issues and remove an incorrect test case.

Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMElementTest.java

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj?rev=1700273&r1=1700272&r2=1700273&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
Mon Aug 31 16:29:32 2015
@@ -293,19 +293,7 @@ public aspect AxiomElementSupport {
             }
             attr = getOMFactory().createOMAttribute(attr.getLocalName(), attr.getNamespace(),
attr.getAttributeValue());
         }
-
-        OMNamespace namespace = attr.getNamespace();
-        if (namespace != null) {
-            String uri = namespace.getNamespaceURI();
-            if (uri.length() > 0) {
-                String prefix = namespace.getPrefix();
-                OMNamespace ns2 = findNamespaceURI(prefix);
-                if (ns2 == null || !uri.equals(ns2.getNamespaceURI())) {
-                    declareNamespace(uri, prefix);
-                }
-            }
-        }
-
+        NSUtil.handleNamespace(this, attr.getNamespace(), true, true);
         internalAppendAttribute(attr);
         return attr;
     }
@@ -442,7 +430,7 @@ public aspect AxiomElementSupport {
             if (parent instanceof OMElement) {
                 namespace = ((OMElement) parent).findNamespace(uri, prefix);
                 // If the prefix has been redeclared, then ignore the binding found on the
ancestors
-                if (prefix == null && namespace != null && findDeclaredNamespace(null,
namespace.getPrefix()) != null) {
+                if (namespace != null && findDeclaredNamespace(null, namespace.getPrefix())
!= null) {
                     namespace = null;
                 }
             }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1700273&r1=1700272&r2=1700273&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
Mon Aug 31 16:29:32 2015
@@ -21,6 +21,8 @@ package org.apache.axiom.om.impl.dom;
 
 import static org.apache.axiom.dom.DOMExceptionTranslator.newDOMException;
 
+import javax.xml.XMLConstants;
+
 import org.apache.axiom.core.ClonePolicy;
 import org.apache.axiom.core.NodeMigrationException;
 import org.apache.axiom.core.NodeMigrationPolicy;
@@ -41,6 +43,9 @@ public abstract class ElementImpl extend
     }
 
     private final String checkNamespaceIsDeclared(String prefix, String namespaceURI, boolean
allowDefaultNamespace, boolean declare) {
+        if (XMLConstants.XML_NS_PREFIX.equals(prefix) && XMLConstants.XML_NS_URI.equals(namespaceURI))
{
+            return XMLConstants.XML_NS_PREFIX;
+        }
         if (prefix == null) {
             if (namespaceURI.length() == 0) {
                 prefix = "";

Modified: webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMElementTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMElementTest.java?rev=1700273&r1=1700272&r2=1700273&view=diff
==============================================================================
--- webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMElementTest.java
(original)
+++ webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMElementTest.java
Mon Aug 31 16:29:32 2015
@@ -77,29 +77,6 @@ public class OMElementTest extends OMTes
         }
     }
 
-    public void testConstructors() {
-        assertTrue("Namespace having same information, declared in the same context, should
share" +
-                " the same namespace object",
-                   firstElement.getNamespace() != secondElement.getNamespace());
-        assertEquals("OMElement children addition has not worked properly", secondElement,
-                     firstElement.getFirstElement());
-
-        OMNamespace testNamespace2 = factory.createOMNamespace("ftp://anotherTest.ws.org",
"ws");
-        firstElement.declareNamespace(testNamespace2);
-
-        OMNamespace inheritedSecondNamespace =
-                secondElement.findNamespace(testNamespace2.getNamespaceURI(),
-                                            testNamespace2.getPrefix());
-        assertNotNull("Children should inherit namespaces declared in parent",
-                      inheritedSecondNamespace);
-        assertEquals("inherited namespace uri should be equal",
-                     inheritedSecondNamespace.getNamespaceURI(), testNamespace2.getNamespaceURI());
-        assertEquals("inherited namespace prefix should be equal",
-                     inheritedSecondNamespace.getPrefix(), testNamespace2.getPrefix());
-
-
-    }
-
     public void testChildDetachment() {
         OMNamespace testNamespace2 = factory.createOMNamespace("ftp://anotherTest.ws.org",
"ws");
 



Mime
View raw message