ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1325131 - in /webservices/axiom/branches/AXIOM-412: ./ modules/axiom-api/src/main/java/org/apache/axiom/om/ modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/ modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/do...
Date Thu, 12 Apr 2012 06:20:13 GMT
Author: veithen
Date: Thu Apr 12 06:20:13 2012
New Revision: 1325131

URL: http://svn.apache.org/viewvc?rev=1325131&view=rev
Log:
Merged latest changes from trunk.

Added:
    webservices/axiom/branches/AXIOM-412/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestRemoveAttributeNotOwner.java
      - copied unchanged from r1325130, webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestRemoveAttributeNotOwner.java
    webservices/axiom/branches/AXIOM-412/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestRemoveAttribute.java
      - copied unchanged from r1325130, webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestRemoveAttribute.java
    webservices/axiom/branches/AXIOM-412/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestRemoveAttributeNotOwner.java
      - copied unchanged from r1325130, webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestRemoveAttributeNotOwner.java
Modified:
    webservices/axiom/branches/AXIOM-412/   (props changed)
    webservices/axiom/branches/AXIOM-412/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
    webservices/axiom/branches/AXIOM-412/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
    webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
    webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/axiom/branches/AXIOM-412/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
    webservices/axiom/branches/AXIOM-412/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java

Propchange: webservices/axiom/branches/AXIOM-412/
------------------------------------------------------------------------------
  Merged /webservices/commons/trunk/modules/axiom:r1325018-1325130

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java?rev=1325131&r1=1325130&r2=1325131&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
Thu Apr 12 06:20:13 2012
@@ -372,9 +372,12 @@ public interface OMElement extends OMNod
     OMAttribute addAttribute(String localName, String value, OMNamespace ns);
 
     /**
-     * Method removeAttribute
-     *
+     * Removes the given attribute from this element.
+     * 
      * @param attr
+     *            the attribute to remove
+     * @throws OMException
+     *             if the attribute is not owned by this element
      */
     void removeAttribute(OMAttribute attr);
 

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java?rev=1325131&r1=1325130&r2=1325131&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
Thu Apr 12 06:20:13 2012
@@ -70,6 +70,7 @@ public class DOMTestSuiteBuilder extends
         addTest(new org.apache.axiom.ts.dom.element.TestGetTextContent(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestInsertBefore(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestInsertBeforeWithDocumentFragment(dbf));
+        addTest(new org.apache.axiom.ts.dom.element.TestRemoveAttributeNotOwner(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestRemoveFirstChild(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestRemoveLastChild(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestRemoveSingleChild(dbf));

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java?rev=1325131&r1=1325130&r2=1325131&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
Thu Apr 12 06:20:13 2012
@@ -430,4 +430,10 @@ public class AttributeMap implements Nam
             nodes.removeAllElements();
         }
     }
+    
+    void remove(AttrImpl attr) {
+        if (nodes.remove(attr)) {
+            attr.setOwnerElement(null);
+        }
+    }
 }

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1325131&r1=1325130&r2=1325131&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
Thu Apr 12 06:20:13 2012
@@ -31,7 +31,6 @@ import org.apache.axiom.om.impl.OMElemen
 import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.common.NamespaceIterator;
 import org.apache.axiom.om.impl.common.OMChildElementIterator;
-import org.apache.axiom.om.impl.common.OMDescendantsIterator;
 import org.apache.axiom.om.impl.common.OMElementImplUtil;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 import org.apache.axiom.om.impl.traverse.OMQNameFilterIterator;
@@ -333,14 +332,13 @@ public class ElementImpl extends ParentN
      * @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr)
      */
     public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
-        if (this.attributes == null
-                || this.attributes.getNamedItem(oldAttr.getName()) == null) {
+        if (oldAttr.getOwnerElement() != this) {
             String msg = DOMMessageFormatter.formatMessage(
                     DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null);
             throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
         }
-        return (AttrImpl) this.attributes.removeNamedItem(oldAttr
-                .getName());
+        attributes.remove((AttrImpl)oldAttr);
+        return oldAttr;
     }
 
     /*
@@ -974,13 +972,11 @@ public class ElementImpl extends ParentN
         OMElementImplUtil.writeTextTo(this, out, cache);
     }
 
-    /**
-     * Removes an attribute from the element.
-     *
-     * @see org.apache.axiom.om.OMElement#removeAttribute (org.apache.axiom.om.OMAttribute)
-     */
     public void removeAttribute(OMAttribute attr) {
-        this.removeAttributeNode((AttrImpl) attr);
+        if (attr.getOwner() != this) {
+            throw new OMException("The attribute is not owned by this element");
+        }
+        attributes.remove((AttrImpl)attr);
     }
 
     /**

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=1325131&r1=1325130&r2=1325131&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
Thu Apr 12 06:20:13 2012
@@ -665,13 +665,13 @@ public class OMElementImpl extends OMNod
         return attr;
     }
 
-    /** Method removeAttribute. */
     public void removeAttribute(OMAttribute attr) {
-        if (attributes != null) {
-            // Remove the owner from this attribute
-            ((OMAttributeImpl)attr).owner = null;
-            attributes.remove(attr.getQName());
+        if (attr.getOwner() != this) {
+            throw new OMException("The attribute is not owned by this element");
         }
+        // Remove the owner from this attribute
+        ((OMAttributeImpl)attr).owner = null;
+        attributes.remove(attr.getQName());
     }
 
     public OMAttribute addAttribute(String attributeName, String value,

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1325131&r1=1325130&r2=1325131&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
Thu Apr 12 06:20:13 2012
@@ -211,6 +211,8 @@ public class OMTestSuiteBuilder extends 
         addTest(new org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithPreserveNamespaceContext(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestIsCompleteAfterAddingIncompleteChild(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestMultipleDefaultNS(metaFactory));
+        addTest(new org.apache.axiom.ts.om.element.TestRemoveAttribute(metaFactory));
+        addTest(new org.apache.axiom.ts.om.element.TestRemoveAttributeNotOwner(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestResolveQNameWithDefaultNamespace(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestResolveQNameWithNonDefaultNamespace(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestResolveQNameWithoutNamespace(metaFactory));



Mime
View raw message