ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1729475 - in /webservices/axiom/trunk: aspects/core-aspects/src/main/java/org/apache/axiom/core/ aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/ aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ aspects/dom-aspec...
Date Tue, 09 Feb 2016 22:02:05 GMT
Author: veithen
Date: Tue Feb  9 22:02:04 2016
New Revision: 1729475

URL: http://svn.apache.org/viewvc?rev=1729475&view=rev
Log:
Don't use OMException in core-aspects.

Added:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/HierarchyException.java
  (with props)
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NoParentException.java
  (with props)
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/SelfRelationshipException.java
  (with props)
Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMExceptionUtil.java
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMSemantics.java
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMTextNodeSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomChildNodeSupport.aj
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java

Added: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/HierarchyException.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/HierarchyException.java?rev=1729475&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/HierarchyException.java
(added)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/HierarchyException.java
Tue Feb  9 22:02:04 2016
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.core;
+
+/**
+ * Indicates that an attempt was made to perform an operation that would cause a violation
of some
+ * constraint on the tree structure of a valid XML document. See the subclasses for the possible
+ * types of violations.
+ */
+public abstract class HierarchyException extends CoreModelException {
+    private static final long serialVersionUID = 1L;
+
+    public HierarchyException() {
+        super();
+    }
+
+    public HierarchyException(String message) {
+        super(message);
+    }
+}

Propchange: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/HierarchyException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NoParentException.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NoParentException.java?rev=1729475&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NoParentException.java
(added)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NoParentException.java
Tue Feb  9 22:02:04 2016
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.core;
+
+/**
+ * Indicates that an operation could not be completed because a node is expected to have
a parent,
+ * but didn't have one.
+ */
+public class NoParentException extends HierarchyException {
+    private static final long serialVersionUID = 1L;
+
+    public NoParentException() {
+    }
+
+    public NoParentException(String message) {
+        super(message);
+    }
+}

Propchange: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NoParentException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/SelfRelationshipException.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/SelfRelationshipException.java?rev=1729475&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/SelfRelationshipException.java
(added)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/SelfRelationshipException.java
Tue Feb  9 22:02:04 2016
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.core;
+
+/**
+ * Indicates that an attempt was made to perform an operation that would create a relationship
+ * between a node and itself.
+ */
+public class SelfRelationshipException extends HierarchyException {
+    private static final long serialVersionUID = 1L;
+
+    public SelfRelationshipException() {
+    }
+
+    public SelfRelationshipException(String message) {
+        super(message);
+    }
+}

Propchange: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/SelfRelationshipException.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=1729475&r1=1729474&r2=1729475&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
Tue Feb  9 22:02:04 2016
@@ -24,13 +24,15 @@ import org.apache.axiom.core.CoreChildNo
 import org.apache.axiom.core.CoreDocument;
 import org.apache.axiom.core.CoreDocumentFragment;
 import org.apache.axiom.core.CoreElement;
+import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.core.CoreNode;
 import org.apache.axiom.core.CoreParentNode;
+import org.apache.axiom.core.NoParentException;
 import org.apache.axiom.core.NodeFilter;
+import org.apache.axiom.core.SelfRelationshipException;
 import org.apache.axiom.core.Semantics;
 import org.apache.axiom.core.impl.Flags;
 import org.apache.axiom.om.NodeUnavailableException;
-import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.impl.builder.Builder;
 
 public aspect CoreChildNodeSupport {
@@ -112,7 +114,7 @@ public aspect CoreChildNodeSupport {
         this.previousSibling = previousSibling;
     }
     
-    public final CoreChildNode CoreChildNode.coreGetNextSibling() throws OMException {
+    public final CoreChildNode CoreChildNode.coreGetNextSibling() {
         CoreChildNode nextSibling = coreGetNextSiblingIfAvailable();
         if (nextSibling == null) {
             CoreParentNode parent = coreGetParent();
@@ -140,13 +142,12 @@ public aspect CoreChildNodeSupport {
         return sibling;
     }
     
-    public final void CoreChildNode.coreInsertSiblingAfter(CoreChildNode sibling) {
+    public final void CoreChildNode.coreInsertSiblingAfter(CoreChildNode sibling) throws
CoreModelException {
         CoreParentNode parent = coreGetParent();
-        // TODO: don't use OMException here
         if (parent == null) {
-            throw new OMException("Parent can not be null");
+            throw new NoParentException("Parent can not be null");
         } else if (this == sibling) {
-            throw new OMException("Inserting self as the sibling is not allowed");
+            throw new SelfRelationshipException("Inserting self as the sibling is not allowed");
         }
         sibling.internalDetach(null, parent);
         CoreChildNode nextSibling = coreGetNextSibling();
@@ -160,13 +161,12 @@ public aspect CoreChildNodeSupport {
         this.nextSibling = sibling;
     }
     
-    public final void CoreChildNode.coreInsertSiblingBefore(CoreChildNode sibling) {
+    public final void CoreChildNode.coreInsertSiblingBefore(CoreChildNode sibling) throws
CoreModelException {
         CoreParentNode parent = coreGetParent();
-        // TODO: don't use OMException here
         if (parent == null) {
-            throw new OMException("Parent can not be null");
+            throw new NoParentException("Parent can not be null");
         } else if (this == sibling) {
-            throw new OMException("Inserting self as the sibling is not allowed");
+            throw new SelfRelationshipException("Inserting self as the sibling is not allowed");
         }
         sibling.internalDetach(null, parent);
         sibling.nextSibling = this;

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj?rev=1729475&r1=1729474&r2=1729475&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
Tue Feb  9 22:02:04 2016
@@ -42,7 +42,6 @@ import org.apache.axiom.core.impl.Flags;
 import org.apache.axiom.core.impl.NodesIterator;
 import org.apache.axiom.om.NodeUnavailableException;
 import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.builder.Builder;
@@ -112,7 +111,7 @@ public aspect CoreParentNodeSupport {
         if (builder == null) {
             throw new IllegalStateException("The node has no builder");
         } else if (((Builder)builder).isClosed()) {
-            throw new OMException("The builder has already been closed");
+            throw new IllegalStateException("The builder has already been closed");
         } else if (!builder.isCompleted()) {
             builder.next();
         } else {

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMExceptionUtil.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMExceptionUtil.java?rev=1729475&r1=1729474&r2=1729475&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMExceptionUtil.java
(original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMExceptionUtil.java
Tue Feb  9 22:02:04 2016
@@ -22,6 +22,8 @@ import java.util.MissingResourceExceptio
 import java.util.PropertyResourceBundle;
 import java.util.ResourceBundle;
 
+import org.apache.axiom.core.CoreModelException;
+import org.apache.axiom.core.HierarchyException;
 import org.w3c.dom.DOMException;
 
 public final class DOMExceptionUtil {
@@ -65,4 +67,12 @@ public final class DOMExceptionUtil {
             return new DOMException(code, key + ": " + message);
         }
     }
+    
+    public static RuntimeException toUncheckedException(CoreModelException ex) {
+        if (ex instanceof HierarchyException) {
+            return newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
+        } else {
+            return new RuntimeException(ex);
+        }
+    }
 }

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMSemantics.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMSemantics.java?rev=1729475&r1=1729474&r2=1729475&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMSemantics.java
(original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMSemantics.java
Tue Feb  9 22:02:04 2016
@@ -150,6 +150,6 @@ public final class DOMSemantics implemen
     };
 
     public RuntimeException toUncheckedException(CoreModelException ex) {
-        throw new IllegalArgumentException("Don't know how to translate " + ex.getClass().getName());
+        return DOMExceptionUtil.toUncheckedException(ex);
     }
 }

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMTextNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMTextNodeSupport.aj?rev=1729475&r1=1729474&r2=1729475&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMTextNodeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMTextNodeSupport.aj
Tue Feb  9 22:02:04 2016
@@ -19,6 +19,8 @@
 package org.apache.axiom.dom.impl.mixin;
 
 import org.apache.axiom.core.CoreChildNode;
+import org.apache.axiom.core.CoreModelException;
+import org.apache.axiom.dom.DOMExceptionUtil;
 import org.apache.axiom.dom.DOMSemantics;
 import org.apache.axiom.dom.DOMText;
 import org.apache.axiom.dom.DOMTextNode;
@@ -73,27 +75,31 @@ public aspect DOMTextNodeSupport {
     }
 
     public final Text DOMTextNode.replaceWholeText(String content) throws DOMException {
-        DOMText newText;
-        if (content.length() > 0) {
-            newText = coreGetNodeFactory().createNode(DOMText.class);
-            newText.coreSetCharacterData(content);
-        } else {
-            newText = null;
-        }
-        if (coreHasParent()) {
-            DOMTextNode first = getWholeTextStartNode();
-            DOMTextNode last = getWholeTextEndNode();
-            if (newText != null) {
-                first.coreInsertSiblingBefore(newText);
+        try {
+            DOMText newText;
+            if (content.length() > 0) {
+                newText = coreGetNodeFactory().createNode(DOMText.class);
+                newText.coreSetCharacterData(content);
+            } else {
+                newText = null;
             }
-            DOMTextNode current = first;
-            DOMTextNode next;
-            do {
-                next = current == last ? null : (DOMTextNode)current.coreGetNextSibling();
-                current.coreDetach(DOMSemantics.INSTANCE);
-                current = next;
-            } while (next != null);
+            if (coreHasParent()) {
+                DOMTextNode first = getWholeTextStartNode();
+                DOMTextNode last = getWholeTextEndNode();
+                if (newText != null) {
+                    first.coreInsertSiblingBefore(newText);
+                }
+                DOMTextNode current = first;
+                DOMTextNode next;
+                do {
+                    next = current == last ? null : (DOMTextNode)current.coreGetNextSibling();
+                    current.coreDetach(DOMSemantics.INSTANCE);
+                    current = next;
+                } while (next != null);
+            }
+            return newText;
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
         }
-        return newText;
     }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomChildNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomChildNodeSupport.aj?rev=1729475&r1=1729474&r2=1729475&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomChildNodeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomChildNodeSupport.aj
Tue Feb  9 22:02:04 2016
@@ -18,10 +18,12 @@
  */
 package org.apache.axiom.om.impl.mixin;
 
+import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.core.CoreParentNode;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.common.AxiomExceptionTranslator;
 import org.apache.axiom.om.impl.common.AxiomSemantics;
 import org.apache.axiom.om.impl.intf.AxiomChildNode;
 import org.apache.axiom.om.impl.intf.AxiomContainer;
@@ -41,19 +43,27 @@ public aspect AxiomChildNodeSupport {
     }
 
     public final void AxiomChildNode.insertSiblingAfter(OMNode sibling) throws OMException
{
-        AxiomContainer parent = (AxiomContainer)getParent();
-        if (parent == null) {
-            throw new OMException("Parent can not be null");
+        try {
+            AxiomContainer parent = (AxiomContainer)getParent();
+            if (parent == null) {
+                throw new OMException("Parent can not be null");
+            }
+            coreInsertSiblingAfter(parent.prepareNewChild(sibling));
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
         }
-        coreInsertSiblingAfter(parent.prepareNewChild(sibling));
     }
 
     public final void AxiomChildNode.insertSiblingBefore(OMNode sibling) throws OMException
{
-        AxiomContainer parent = (AxiomContainer)getParent();
-        if (parent == null) {
-            throw new OMException("Parent can not be null");
+        try {
+            AxiomContainer parent = (AxiomContainer)getParent();
+            if (parent == null) {
+                throw new OMException("Parent can not be null");
+            }
+            coreInsertSiblingBefore(parent.prepareNewChild(sibling));
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
         }
-        coreInsertSiblingBefore(parent.prepareNewChild(sibling));
     }
     
     public OMNode AxiomChildNode.detach() {

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=1729475&r1=1729474&r2=1729475&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
Tue Feb  9 22:02:04 2016
@@ -23,6 +23,8 @@ import static org.apache.axiom.dom.DOMEx
 
 import org.apache.axiom.core.CoreChildNode;
 import org.apache.axiom.core.CoreDocumentFragment;
+import org.apache.axiom.core.CoreModelException;
+import org.apache.axiom.dom.DOMExceptionUtil;
 import org.apache.axiom.dom.DOMParentNode;
 import org.apache.axiom.dom.DOMSemantics;
 import org.w3c.dom.DOMException;
@@ -77,52 +79,60 @@ public abstract class ParentNode extends
      * last child.
      */
     public Node insertBefore(Node newChild, Node refChild) throws DOMException {
-        if (refChild == null) {
-            return appendChild(newChild);
-        } else {
-            if (!(refChild instanceof CoreChildNode && ((CoreChildNode)refChild).coreGetParent()
== this)) {
-                throw newDOMException(DOMException.NOT_FOUND_ERR);
-            }
-            checkNewChild(newChild, null);
-            if (newChild instanceof CoreChildNode) {
-                ((CoreChildNode)refChild).coreInsertSiblingBefore((CoreChildNode)newChild);
-            } else if (newChild instanceof CoreDocumentFragment) {
-                ((CoreChildNode)refChild).coreInsertSiblingsBefore((CoreDocumentFragment)newChild);
+        try {
+            if (refChild == null) {
+                return appendChild(newChild);
             } else {
-                throw newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
+                if (!(refChild instanceof CoreChildNode && ((CoreChildNode)refChild).coreGetParent()
== this)) {
+                    throw newDOMException(DOMException.NOT_FOUND_ERR);
+                }
+                checkNewChild(newChild, null);
+                if (newChild instanceof CoreChildNode) {
+                    ((CoreChildNode)refChild).coreInsertSiblingBefore((CoreChildNode)newChild);
+                } else if (newChild instanceof CoreDocumentFragment) {
+                    ((CoreChildNode)refChild).coreInsertSiblingsBefore((CoreDocumentFragment)newChild);
+                } else {
+                    throw newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
+                }
+                return newChild;
             }
-            return newChild;
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
         }
     }
 
     /** Replaces the oldChild with the newChild. */
     public final Node replaceChild(Node newChild, Node _oldChild) throws DOMException {
-        if (!(_oldChild instanceof CoreChildNode)) {
-            throw newDOMException(DOMException.NOT_FOUND_ERR);
-        }
-        CoreChildNode oldChild = (CoreChildNode)_oldChild;
-        if (oldChild.coreGetParent() != this) {
-            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, false);
-            } else {
-                nextSibling.coreInsertSiblingBefore((CoreChildNode)newChild);
+        try {
+            if (!(_oldChild instanceof CoreChildNode)) {
+                throw newDOMException(DOMException.NOT_FOUND_ERR);
             }
-        } else if (newChild instanceof CoreDocumentFragment) {
-            if (nextSibling == null) {
-                coreAppendChildren((CoreDocumentFragment)newChild);
+            CoreChildNode oldChild = (CoreChildNode)_oldChild;
+            if (oldChild.coreGetParent() != this) {
+                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, false);
+                } else {
+                    nextSibling.coreInsertSiblingBefore((CoreChildNode)newChild);
+                }
+            } else if (newChild instanceof CoreDocumentFragment) {
+                if (nextSibling == null) {
+                    coreAppendChildren((CoreDocumentFragment)newChild);
+                } else {
+                    nextSibling.coreInsertSiblingsBefore((CoreDocumentFragment)newChild);
+                }
             } else {
-                nextSibling.coreInsertSiblingsBefore((CoreDocumentFragment)newChild);
+                throw newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
             }
-        } else {
-            throw newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
+            return _oldChild;
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
         }
-        return _oldChild;
     }
 
     /**

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java?rev=1729475&r1=1729474&r2=1729475&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
Tue Feb  9 22:02:04 2016
@@ -21,6 +21,8 @@ package org.apache.axiom.om.impl.dom;
 
 import static org.apache.axiom.dom.DOMExceptionUtil.newDOMException;
 
+import org.apache.axiom.core.CoreModelException;
+import org.apache.axiom.dom.DOMExceptionUtil;
 import org.apache.axiom.dom.DOMTextNode;
 import org.apache.axiom.om.impl.intf.AxiomText;
 import org.w3c.dom.DOMException;
@@ -36,22 +38,26 @@ public abstract class TextNodeImpl exten
      * node has no data.
      */
     public Text splitText(int offset) throws DOMException {
-        String value = getData();
-        if (offset < 0 || offset > value.length()) {
-            throw newDOMException(DOMException.INDEX_SIZE_ERR);
+        try {
+            String value = getData();
+            if (offset < 0 || offset > value.length()) {
+                throw newDOMException(DOMException.INDEX_SIZE_ERR);
+            }
+            String newValue = value.substring(offset);
+            this.deleteData(offset, value.length());
+    
+            TextImpl newText = (TextImpl) this.getOwnerDocument().createTextNode(
+                    newValue);
+    
+            ParentNode parentNode = (ParentNode)coreGetParent();
+            if (parentNode != null) {
+                coreInsertSiblingAfter(newText);
+            }
+    
+            return newText;
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
         }
-        String newValue = value.substring(offset);
-        this.deleteData(offset, value.length());
-
-        TextImpl newText = (TextImpl) this.getOwnerDocument().createTextNode(
-                newValue);
-
-        ParentNode parentNode = (ParentNode)coreGetParent();
-        if (parentNode != null) {
-            coreInsertSiblingAfter(newText);
-        }
-
-        return newText;
     }
 
     // /

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java?rev=1729475&r1=1729474&r2=1729475&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
Tue Feb  9 22:02:04 2016
@@ -29,9 +29,11 @@ import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
 import org.apache.abdera.model.Source;
+import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.fom.AbderaElement;
 import org.apache.axiom.fom.AbderaEntry;
 import org.apache.axiom.fom.AbderaFeed;
+import org.apache.axiom.fom.FOMSemantics;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNode;
 
@@ -84,14 +86,18 @@ public class FOMFeed extends FOMSource i
 
     @Override
     public void _addChild(AbderaElement element) {
-        if (!(element instanceof Entry)) {
-            AbderaElement entry = _getFirstChildWithName(ENTRY);
-            if (entry != null) {
-                entry.coreInsertSiblingBefore(element);
-                return;
+        try {
+            if (!(element instanceof Entry)) {
+                AbderaElement entry = _getFirstChildWithName(ENTRY);
+                if (entry != null) {
+                    entry.coreInsertSiblingBefore(element);
+                    return;
+                }
             }
+            coreAppendChild(element, false);
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
         }
-        coreAppendChild(element, false);
     }
 
     public Feed sortEntriesByUpdated(boolean new_first) {



Mime
View raw message