ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1740393 - in /webservices/axiom/trunk: aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/ aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/ implementations/axiom-dom/src/main/java/org/apache/axiom/...
Date Thu, 21 Apr 2016 19:46:17 GMT
Author: veithen
Date: Thu Apr 21 19:46:17 2016
New Revision: 1740393

URL: http://svn.apache.org/viewvc?rev=1740393&view=rev
Log:
Use coreReplaceWith.

Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/CustomBuilderManager.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj?rev=1740393&r1=1740392&r2=1740393&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
Thu Apr 21 19:46:17 2016
@@ -241,12 +241,13 @@ public aspect CoreChildNodeSupport {
         }
     }
 
-    public final void CoreChildNode.coreReplaceWith(CoreChildNode newNode, Semantics semantics)
{
+    public final void CoreChildNode.coreReplaceWith(CoreChildNode newNode, Semantics semantics)
throws CoreModelException {
         if (newNode == this) {
             return;
         }
         CoreParentNode parent = coreGetParent();
         if (parent != null) {
+            parent.internalCheckNewChild(newNode, this);
             newNode.internalDetach(null, parent);
             if (previousSibling == null) {
                 parent.getContent(true).firstChild = newNode;

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/CustomBuilderManager.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/CustomBuilderManager.java?rev=1740393&r1=1740392&r2=1740393&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/CustomBuilderManager.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/CustomBuilderManager.java
Thu Apr 21 19:46:17 2016
@@ -23,11 +23,13 @@ import java.util.ArrayList;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.core.CoreNode;
 import org.apache.axiom.core.impl.builder.BuilderListener;
 import org.apache.axiom.om.OMDataSource;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.ds.custombuilder.CustomBuilder;
+import org.apache.axiom.om.impl.common.AxiomExceptionTranslator;
 import org.apache.axiom.om.impl.common.AxiomSemantics;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 import org.apache.axiom.om.impl.intf.AxiomElement;
@@ -119,7 +121,11 @@ final class CustomBuilderManager impleme
                                 }
                                 AxiomSourcedElement newElement = element.coreCreateNode(type);
                                 newElement.init(localName, new OMNamespaceImpl(namespaceURI,
null), dataSource);
-                                element.coreReplaceWith(newElement, AxiomSemantics.INSTANCE);
+                                try {
+                                    element.coreReplaceWith(newElement, AxiomSemantics.INSTANCE);
+                                } catch (CoreModelException ex) {
+                                    throw AxiomExceptionTranslator.translate(ex);
+                                }
                             }
                         };
                     }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?rev=1740393&r1=1740392&r2=1740393&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
Thu Apr 21 19:46:17 2016
@@ -115,15 +115,11 @@ public abstract class ParentNode extends
                 throw newDOMException(DOMException.NOT_FOUND_ERR);
             }
             checkNewChild(newChild, _oldChild);
-            CoreChildNode nextSibling = oldChild.coreGetNextSibling();
-            oldChild.coreDetach(DOMSemantics.INSTANCE);
             if (newChild instanceof CoreChildNode) {
-                if (nextSibling == null) {
-                    coreAppendChild((CoreChildNode)newChild);
-                } else {
-                    nextSibling.coreInsertSiblingBefore((CoreChildNode)newChild);
-                }
+                oldChild.coreReplaceWith(((CoreChildNode)newChild), DOMSemantics.INSTANCE);
             } else if (newChild instanceof CoreDocumentFragment) {
+                CoreChildNode nextSibling = oldChild.coreGetNextSibling();
+                oldChild.coreDetach(DOMSemantics.INSTANCE);
                 if (nextSibling == null) {
                     coreAppendChildren((CoreDocumentFragment)newChild);
                 } else {



Mime
View raw message