ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1734640 - 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 Fri, 11 Mar 2016 22:59:45 GMT
Author: veithen
Date: Fri Mar 11 22:59:45 2016
New Revision: 1734640

URL: http://svn.apache.org/viewvc?rev=1734640&view=rev
Log:
Cleanly reimplement Axiom's build/isComplete methods.

Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/AttributeMatcher.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCharacterDataSinkNode.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreElementSupport.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/DOMSemantics.java
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMAttributeSupport.aj
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMCDATASectionSupport.aj
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMCommentSupport.aj
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentFragmentSupport.aj
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMElementSupport.aj
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMParentNodeSupport.aj
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMProcessingInstructionSupport.aj
    webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaAttributeMixin.aj
    webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaProcessingInstructionMixin.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuildableContext.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomAttributeSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCDATASectionSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCommentSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCoreParentNodeSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamespaceDeclarationSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomProcessingInstructionSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/AttributeMatcher.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/AttributeMatcher.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/AttributeMatcher.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/AttributeMatcher.java Fri Mar 11 22:59:45 2016
@@ -81,8 +81,9 @@ public interface AttributeMatcher {
      * @param value
      *            see above
      * @return
+     * @throws CoreModelException 
      */
-    CoreAttribute createAttribute(CoreElement element, String namespaceURI, String name, String prefix, String value);
+    CoreAttribute createAttribute(CoreElement element, String namespaceURI, String name, String prefix, String value) throws CoreModelException;
     
     /**
      * Update an existing attribute. The values of the <code>prefix</code> and <code>value</code>
@@ -95,6 +96,7 @@ public interface AttributeMatcher {
      *            see above
      * @param value
      *            see above
+     * @throws CoreModelException 
      */
-    void update(CoreAttribute attr, String prefix, String value);
+    void update(CoreAttribute attr, String prefix, String value) throws CoreModelException;
 }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCharacterDataSinkNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCharacterDataSinkNode.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCharacterDataSinkNode.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreCharacterDataSinkNode.java Fri Mar 11 22:59:45 2016
@@ -19,5 +19,5 @@
 package org.apache.axiom.core;
 
 public interface CoreCharacterDataSinkNode {
-    void coreSetCharacterData(Object data, Semantics semantics);
+    void coreSetCharacterData(Object data, Semantics semantics) throws CoreModelException;
 }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java Fri Mar 11 22:59:45 2016
@@ -44,7 +44,7 @@ public interface CoreParentNode extends
     void coreSetInputContext(InputContext context);
     int getState();
     void coreSetState(int state);
-    void build();
+    void coreBuild() throws CoreModelException;
 
     <T> NodeIterator<T> coreGetNodes(Axis axis, Mapper<? super CoreNode,T> mapper, Semantics semantics);
 

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NSAwareAttributeMatcher.java Fri Mar 11 22:59:45 2016
@@ -84,14 +84,14 @@ public final class NSAwareAttributeMatch
         return ((CoreNSAwareAttribute)attr).coreGetLocalName();
     }
 
-    public CoreAttribute createAttribute(CoreElement element, String namespaceURI, String name, String prefix, String value) {
+    public CoreAttribute createAttribute(CoreElement element, String namespaceURI, String name, String prefix, String value) throws CoreModelException {
         CoreNSAwareAttribute attr = element.coreCreateNode(CoreNSAwareAttribute.class);
         attr.coreSetName(namespaceURI, name, prefix);
         attr.coreSetCharacterData(value, null);
         return attr;
     }
 
-    public void update(CoreAttribute attr, String prefix, String value) {
+    public void update(CoreAttribute attr, String prefix, String value) throws CoreModelException {
         attr.coreSetCharacterData(value, semantics);
         if (updatePrefix && attr instanceof CoreNSAwareAttribute) {
             ((CoreNSAwareAttribute)attr).coreSetPrefix(prefix);

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NamespaceDeclarationMatcher.java Fri Mar 11 22:59:45 2016
@@ -63,7 +63,7 @@ public final class NamespaceDeclarationM
         return ((CoreNamespaceDeclaration)attr).coreGetDeclaredPrefix();
     }
 
-    public void update(CoreAttribute attr, String prefix, String value) {
+    public void update(CoreAttribute attr, String prefix, String value) throws CoreModelException {
         attr.coreSetCharacterData(value, semantics);
     }
 }
\ No newline at end of file

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreElementSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreElementSupport.aj (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreElementSupport.aj Fri Mar 11 22:59:45 2016
@@ -72,7 +72,7 @@ public aspect CoreElementSupport {
         }
     }
 
-    public final void CoreElement.coreSetAttribute(AttributeMatcher matcher, String namespaceURI, String name, String prefix, String value) {
+    public final void CoreElement.coreSetAttribute(AttributeMatcher matcher, String namespaceURI, String name, String prefix, String value) throws CoreModelException {
         CoreAttribute attr = firstAttribute;
         CoreAttribute previousAttr = null;
         while (attr != null && !matcher.matches(attr, namespaceURI, name)) {

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=1734640&r1=1734639&r2=1734640&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 Fri Mar 11 22:59:45 2016
@@ -54,15 +54,20 @@ public aspect CoreParentNodeSupport {
     private InputContext CoreParentNode.context;
     private Object CoreParentNode.content;
     
-    // TODO: rename & make final
-    public int CoreParentNode.getState() {
+    // TODO: rename
+    public final int CoreParentNode.getState() {
         return flags & Flags.STATE_MASK;
     }
     
     public final void CoreParentNode.coreSetState(int state) {
         flags = (flags & ~Flags.STATE_MASK) | state;
+        if (state == COMPLETE) {
+            completed();
+        }
     }
     
+    public void CoreParentNode.completed() {}
+    
     public boolean CoreParentNode.isExpanded() {
         return true;
     }
@@ -163,12 +168,12 @@ public aspect CoreParentNodeSupport {
         return child;
     }
     
-    public final CoreChildNode CoreParentNode.coreGetLastChild() {
-        build();
+    public final CoreChildNode CoreParentNode.coreGetLastChild() throws CoreModelException {
+        coreBuild();
         return coreGetLastKnownChild();
     }
 
-    public final CoreChildNode CoreParentNode.coreGetLastChild(NodeFilter filter) {
+    public final CoreChildNode CoreParentNode.coreGetLastChild(NodeFilter filter) throws CoreModelException {
         CoreChildNode child = coreGetLastChild();
         while (child != null && !filter.accept(child)) {
             child = child.coreGetPreviousSibling();
@@ -176,9 +181,9 @@ public aspect CoreParentNodeSupport {
         return child;
     }
     
-    public final void CoreParentNode.coreAppendChild(CoreChildNode child) {
-        // TODO: this is wrong; we only need to build the node locally, but build() builds incomplete children as well
-        build();
+    public final void CoreParentNode.coreAppendChild(CoreChildNode child) throws CoreModelException {
+        forceExpand();
+        coreBuild();
         internalAppendChildWithoutBuild(child);
     }
     
@@ -200,14 +205,14 @@ public aspect CoreParentNodeSupport {
         content.lastChild = child;
     }
 
-    public final void CoreParentNode.coreAppendChildren(CoreDocumentFragment fragment) {
-        fragment.build();
+    public final void CoreParentNode.coreAppendChildren(CoreDocumentFragment fragment) throws CoreModelException {
+        fragment.coreBuild();
         Content fragmentContent = fragment.getContent(false);
         if (fragmentContent == null || fragmentContent.firstChild == null) {
             // Fragment is empty; nothing to do
             return;
         }
-        build();
+        coreBuild();
         CoreChildNode child = fragmentContent.firstChild;
         while (child != null) {
             child.internalSetParent(this);
@@ -236,7 +241,6 @@ public aspect CoreParentNodeSupport {
             }
             child = child.coreGetNextSiblingIfAvailable();
         }
-        InputContext context = coreGetInputContext();
         if (context != null) {
             context.discard();
             if (consumeInput) {
@@ -248,7 +252,7 @@ public aspect CoreParentNodeSupport {
         }
     }
 
-    public final void CoreParentNode.coreRemoveChildren(Semantics semantics) {
+    public final void CoreParentNode.coreRemoveChildren(Semantics semantics) throws CoreModelException {
         if (getState() == COMPACT) {
             coreSetState(COMPLETE);
             content = null;
@@ -256,12 +260,12 @@ public aspect CoreParentNodeSupport {
             // We need to call this first because if may modify the state (applies to OMSourcedElements)
             CoreChildNode child = coreGetFirstChildIfAvailable();
             boolean updateState;
-            if (getState() == INCOMPLETE && coreGetBuilder() != null) {
+            if (getState() == INCOMPLETE) {
                 CoreChildNode lastChild = coreGetLastKnownChild();
                 if (lastChild instanceof CoreParentNode) {
-                    ((CoreParentNode)lastChild).build();
+                    ((CoreParentNode)lastChild).coreBuild();
                 }
-                coreGetInputContext().discard();
+                context.discard();
                 updateState = true;
             } else {
                 updateState = false;
@@ -350,7 +354,7 @@ public aspect CoreParentNodeSupport {
         }
     }
     
-    public final void CoreParentNode.coreSetCharacterData(Object data, Semantics semantics) {
+    public final void CoreParentNode.coreSetCharacterData(Object data, Semantics semantics) throws CoreModelException {
         coreRemoveChildren(semantics);
         if (data != null && (data instanceof CharacterData || ((String)data).length() > 0)) {
             coreSetState(COMPACT);
@@ -407,4 +411,19 @@ public aspect CoreParentNodeSupport {
             throw ex.getCoreModelException();
         }
     }
+    
+    public final void CoreParentNode.coreBuild() throws CoreModelException {
+        switch (getState()) {
+            case DISCARDING:
+            case DISCARDED:
+                throw new NodeConsumedException();
+            case INCOMPLETE:
+                if (context != null) {
+                    Builder builder = context.getBuilder();
+                    do {
+                        builder.next();
+                    } while (context != null);
+                }
+        }
+    }
 }

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=1734640&r1=1734639&r2=1734640&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 Fri Mar 11 22:59:45 2016
@@ -88,7 +88,7 @@ public final class DOMSemantics implemen
             return ((DOMAttribute)attr).getName();
         }
 
-        public CoreAttribute createAttribute(CoreElement element, String namespaceURI, String name, String prefix, String value) {
+        public CoreAttribute createAttribute(CoreElement element, String namespaceURI, String name, String prefix, String value) throws CoreModelException {
             CoreNSUnawareAttribute attr = element.coreCreateNode(CoreNSUnawareAttribute.class);
             attr.coreSetName(name);
             attr.coreSetCharacterData(value, null);
@@ -96,7 +96,7 @@ public final class DOMSemantics implemen
             return attr;
         }
 
-        public void update(CoreAttribute attr, String prefix, String value) {
+        public void update(CoreAttribute attr, String prefix, String value) throws CoreModelException {
             attr.coreSetCharacterData(value, INSTANCE);
         }
     };

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMAttributeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMAttributeSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMAttributeSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMAttributeSupport.aj Fri Mar 11 22:59:45 2016
@@ -74,7 +74,11 @@ public aspect DOMAttributeSupport {
     }
     
     public final void DOMAttribute.setValue(String value) {
-        coreSetCharacterData(value, DOMSemantics.INSTANCE);
+        try {
+            coreSetCharacterData(value, DOMSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
     
     public final CoreElement DOMAttribute.getNamespaceContext() {

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMCDATASectionSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMCDATASectionSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMCDATASectionSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMCDATASectionSupport.aj Fri Mar 11 22:59:45 2016
@@ -18,7 +18,9 @@
  */
 package org.apache.axiom.dom.impl.mixin;
 
+import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.dom.DOMCDATASection;
+import org.apache.axiom.dom.DOMExceptionUtil;
 import org.apache.axiom.dom.DOMSemantics;
 import org.w3c.dom.Node;
 
@@ -32,6 +34,10 @@ public aspect DOMCDATASectionSupport {
     }
 
     public final void DOMCDATASection.setData(String data) {
-        coreSetCharacterData(data, DOMSemantics.INSTANCE);
+        try {
+            coreSetCharacterData(data, DOMSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
 }

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMCommentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMCommentSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMCommentSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMCommentSupport.aj Fri Mar 11 22:59:45 2016
@@ -42,6 +42,10 @@ public aspect DOMCommentSupport {
     }
 
     public final void DOMComment.setData(String data) {
-        coreSetCharacterData(data, DOMSemantics.INSTANCE);
+        try {
+            coreSetCharacterData(data, DOMSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
 }

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentFragmentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentFragmentSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentFragmentSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentFragmentSupport.aj Fri Mar 11 22:59:45 2016
@@ -88,6 +88,10 @@ public aspect DOMDocumentFragmentSupport
     }
 
     public final void DOMDocumentFragment.setTextContent(String textContent) {
-        coreSetCharacterData(textContent, DOMSemantics.INSTANCE);
+        try {
+            coreSetCharacterData(textContent, DOMSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
 }

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMDocumentSupport.aj Fri Mar 11 22:59:45 2016
@@ -174,10 +174,14 @@ public aspect DOMDocumentSupport {
     }
 
     public final CDATASection DOMDocument.createCDATASection(String data) {
-        DOMCDATASection cdataSection = coreGetNodeFactory().createNode(DOMCDATASection.class);
-        cdataSection.coreSetOwnerDocument(this);
-        cdataSection.coreSetCharacterData(data, DOMSemantics.INSTANCE);
-        return cdataSection;
+        try {
+            DOMCDATASection cdataSection = coreGetNodeFactory().createNode(DOMCDATASection.class);
+            cdataSection.coreSetOwnerDocument(this);
+            cdataSection.coreSetCharacterData(data, DOMSemantics.INSTANCE);
+            return cdataSection;
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
     
     public final Element DOMDocument.createElement(String tagName) {
@@ -243,11 +247,15 @@ public aspect DOMDocumentSupport {
     }
 
     public final ProcessingInstruction DOMDocument.createProcessingInstruction(String target, String data) {
-        DOMProcessingInstruction pi = coreGetNodeFactory().createNode(DOMProcessingInstruction.class);
-        pi.coreSetOwnerDocument(this);
-        pi.coreSetTarget(target);
-        pi.coreSetCharacterData(data, DOMSemantics.INSTANCE);
-        return pi;
+        try {
+            DOMProcessingInstruction pi = coreGetNodeFactory().createNode(DOMProcessingInstruction.class);
+            pi.coreSetOwnerDocument(this);
+            pi.coreSetTarget(target);
+            pi.coreSetCharacterData(data, DOMSemantics.INSTANCE);
+            return pi;
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
 
     public final EntityReference DOMDocument.createEntityReference(String name) throws DOMException {
@@ -258,10 +266,14 @@ public aspect DOMDocumentSupport {
     }
 
     public final Comment DOMDocument.createComment(String data) {
-        DOMComment node = coreGetNodeFactory().createNode(DOMComment.class);
-        node.coreSetOwnerDocument(this);
-        node.coreSetCharacterData(data, DOMSemantics.INSTANCE);
-        return node;
+        try {
+            DOMComment node = coreGetNodeFactory().createNode(DOMComment.class);
+            node.coreSetOwnerDocument(this);
+            node.coreSetCharacterData(data, DOMSemantics.INSTANCE);
+            return node;
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
 
     public final DocumentFragment DOMDocument.createDocumentFragment() {

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMElementSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMElementSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMElementSupport.aj Fri Mar 11 22:59:45 2016
@@ -113,27 +113,35 @@ public aspect DOMElementSupport {
     }
 
     public final void DOMElement.setAttribute(String name, String value) {
-        NSUtil.validateName(name);
-        coreSetAttribute(DOMSemantics.DOM1_ATTRIBUTE_MATCHER, null, name, null, value);
+        try {
+            NSUtil.validateName(name);
+            coreSetAttribute(DOMSemantics.DOM1_ATTRIBUTE_MATCHER, null, name, null, value);
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
 
     public final void DOMElement.setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException {
-        int i = NSUtil.validateQualifiedName(qualifiedName);
-        String prefix;
-        String localName;
-        if (i == -1) {
-            prefix = "";
-            localName = qualifiedName;
-        } else {
-            prefix = qualifiedName.substring(0, i);
-            localName = qualifiedName.substring(i+1);
-        }
-        if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
-            coreSetAttribute(DOMSemantics.NAMESPACE_DECLARATION_MATCHER, null, NSUtil.getDeclaredPrefix(localName, prefix), null, value);
-        } else {
-            namespaceURI = NSUtil.normalizeNamespaceURI(namespaceURI);
-            NSUtil.validateAttributeName(namespaceURI, localName, prefix);
-            coreSetAttribute(DOMSemantics.DOM2_ATTRIBUTE_MATCHER, namespaceURI, localName, prefix, value);
+        try {
+            int i = NSUtil.validateQualifiedName(qualifiedName);
+            String prefix;
+            String localName;
+            if (i == -1) {
+                prefix = "";
+                localName = qualifiedName;
+            } else {
+                prefix = qualifiedName.substring(0, i);
+                localName = qualifiedName.substring(i+1);
+            }
+            if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
+                coreSetAttribute(DOMSemantics.NAMESPACE_DECLARATION_MATCHER, null, NSUtil.getDeclaredPrefix(localName, prefix), null, value);
+            } else {
+                namespaceURI = NSUtil.normalizeNamespaceURI(namespaceURI);
+                NSUtil.validateAttributeName(namespaceURI, localName, prefix);
+                coreSetAttribute(DOMSemantics.DOM2_ATTRIBUTE_MATCHER, namespaceURI, localName, prefix, value);
+            }
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
         }
     }
 
@@ -207,7 +215,11 @@ public aspect DOMElementSupport {
     }
 
     public final void DOMElement.setTextContent(String textContent) {
-        coreSetCharacterData(textContent, DOMSemantics.INSTANCE);
+        try {
+            coreSetCharacterData(textContent, DOMSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
 
     public final NodeList DOMElement.getElementsByTagName(String tagname) {

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMParentNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMParentNodeSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMParentNodeSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMParentNodeSupport.aj Fri Mar 11 22:59:45 2016
@@ -68,7 +68,11 @@ public aspect DOMParentNodeSupport {
     }
 
     public final Node DOMParentNode.getLastChild() {
-        return (Node)coreGetLastChild(DocumentWhitespaceFilter.INSTANCE);
+        try {
+            return (Node)coreGetLastChild(DocumentWhitespaceFilter.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
 
     public final boolean DOMParentNode.hasChildNodes() {

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMProcessingInstructionSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMProcessingInstructionSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMProcessingInstructionSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/impl/mixin/DOMProcessingInstructionSupport.aj Fri Mar 11 22:59:45 2016
@@ -38,7 +38,11 @@ public aspect DOMProcessingInstructionSu
     }
     
     public final void DOMProcessingInstruction.setData(String data) {
-        coreSetCharacterData(data, DOMSemantics.INSTANCE);
+        try {
+            coreSetCharacterData(data, DOMSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
+        }
     }
     
     public final String DOMProcessingInstruction.getNodeName() {

Modified: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaAttributeMixin.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaAttributeMixin.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaAttributeMixin.aj (original)
+++ webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaAttributeMixin.aj Fri Mar 11 22:59:45 2016
@@ -32,7 +32,11 @@ public aspect AbderaAttributeMixin {
     }
 
     public final Attribute AbderaAttribute.setText(String text) {
-        coreSetCharacterData(text, FOMSemantics.INSTANCE);
-        return this;
+        try {
+            coreSetCharacterData(text, FOMSemantics.INSTANCE);
+            return this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
+        }
     }
 }

Modified: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaProcessingInstructionMixin.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaProcessingInstructionMixin.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaProcessingInstructionMixin.aj (original)
+++ webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaProcessingInstructionMixin.aj Fri Mar 11 22:59:45 2016
@@ -34,7 +34,11 @@ public aspect AbderaProcessingInstructio
 
     @SuppressWarnings("unchecked")
     public final <T extends ProcessingInstruction> T AbderaProcessingInstruction.setText(String text) {
-        coreSetCharacterData(text, FOMSemantics.INSTANCE);
-        return (T)this;
+        try {
+            coreSetCharacterData(text, FOMSemantics.INSTANCE);
+            return (T)this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
+        }
     }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuildableContext.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuildableContext.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuildableContext.java (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuildableContext.java Fri Mar 11 22:59:45 2016
@@ -23,6 +23,8 @@ import org.apache.axiom.core.CoreCDATASe
 import org.apache.axiom.core.CoreCharacterDataNode;
 import org.apache.axiom.core.CoreChildNode;
 import org.apache.axiom.core.CoreDocument;
+import org.apache.axiom.core.CoreModelException;
+import org.apache.axiom.core.CoreModelStreamException;
 import org.apache.axiom.core.CoreParentNode;
 import org.apache.axiom.core.InputContext;
 import org.apache.axiom.core.stream.NullXmlHandler;
@@ -89,11 +91,15 @@ final class BuildableContext extends Con
         builderHandler.decrementActiveContextCount();
     }
 
-    private Context endContext() {
+    private Context endContext() throws StreamException {
         target.coreSetState(CoreParentNode.COMPLETE);
         target.coreSetInputContext(null);
         if (pendingCharacterData != null) {
-            target.coreSetCharacterData(pendingCharacterData, null);
+            try {
+                target.coreSetCharacterData(pendingCharacterData, null);
+            } catch (CoreModelException ex) {
+                throw new CoreModelStreamException(ex);
+            }
             pendingCharacterData = null;
         }
         target = null;
@@ -195,7 +201,11 @@ final class BuildableContext extends Con
             OMNamespace ns = builderHandler.nsCache.getOMNamespace(namespaceURI, prefix);
             AxiomAttribute attr = builderHandler.nodeFactory.createNode(AxiomAttribute.class);
             attr.internalSetLocalName(localName);
-            attr.coreSetCharacterData(value, AxiomSemantics.INSTANCE);
+            try {
+                attr.coreSetCharacterData(value, AxiomSemantics.INSTANCE);
+            } catch (CoreModelException ex) {
+                throw new CoreModelStreamException(ex);
+            }
             attr.internalSetNamespace(ns);
             attr.coreSetType(type);
             attr.coreSetSpecified(specified);

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java Fri Mar 11 22:59:45 2016
@@ -127,7 +127,11 @@ public class OMFactoryImpl implements OM
         if (parent != null) {
             ((AxiomContainer)parent).addChild(node);
         }
-        node.coreSetCharacterData(content, AxiomSemantics.INSTANCE);
+        try {
+            node.coreSetCharacterData(content, AxiomSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
         return node;
     }
 
@@ -192,7 +196,11 @@ public class OMFactoryImpl implements OM
             OMContainer parent, String piTarget, String piData) {
         AxiomProcessingInstruction node = createNode(AxiomProcessingInstruction.class);
         node.coreSetTarget(piTarget);
-        node.coreSetCharacterData(piData, AxiomSemantics.INSTANCE);
+        try {
+            node.coreSetCharacterData(piData, AxiomSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
         if (parent != null) {
             ((AxiomContainer)parent).addChild(node);
         }
@@ -210,7 +218,11 @@ public class OMFactoryImpl implements OM
 
     public final OMComment createOMComment(OMContainer parent, String content) {
         AxiomComment node = createNode(AxiomComment.class);
-        node.coreSetCharacterData(content, AxiomSemantics.INSTANCE);
+        try {
+            node.coreSetCharacterData(content, AxiomSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
         if (parent != null) {
             ((AxiomContainer)parent).addChild(node);
         }
@@ -323,7 +335,11 @@ public class OMFactoryImpl implements OM
         }
         AxiomAttribute attr = createNode(AxiomAttribute.class);
         attr.internalSetLocalName(localName);
-        attr.coreSetCharacterData(value, AxiomSemantics.INSTANCE);
+        try {
+            attr.coreSetCharacterData(value, AxiomSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
         attr.internalSetNamespace(ns);
         attr.coreSetType(OMConstants.XMLATTRTYPE_CDATA);
         return attr;

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomAttributeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomAttributeSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomAttributeSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomAttributeSupport.aj Fri Mar 11 22:59:45 2016
@@ -52,7 +52,11 @@ public aspect AxiomAttributeSupport {
     }
     
     public final void AxiomAttribute.setAttributeValue(String value) {
-        coreSetCharacterData(value, AxiomSemantics.INSTANCE);
+        try {
+            coreSetCharacterData(value, AxiomSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
     }
     
     public final String AxiomAttribute.getAttributeType() {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCDATASectionSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCDATASectionSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCDATASectionSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCDATASectionSupport.aj Fri Mar 11 22:59:45 2016
@@ -38,8 +38,4 @@ public aspect AxiomCDATASectionSupport {
             throw AxiomExceptionTranslator.translate(ex);
         }
     }
-    
-    public final void AxiomCDATASection.build() {
-        // TODO
-    }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCommentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCommentSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCommentSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCommentSupport.aj Fri Mar 11 22:59:45 2016
@@ -41,7 +41,11 @@ public aspect AxiomCommentSupport {
     }
 
     public void AxiomComment.setValue(String text) {
-        coreSetCharacterData(text, AxiomSemantics.INSTANCE);
+        try {
+            coreSetCharacterData(text, AxiomSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
     }
 
     public final void AxiomComment.serialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
@@ -54,8 +58,4 @@ public aspect AxiomCommentSupport {
     
     public final void AxiomComment.buildWithAttachments() {
     }
-    
-    public final void AxiomComment.build() {
-        // TODO
-    }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj Fri Mar 11 22:59:45 2016
@@ -44,14 +44,12 @@ import org.apache.axiom.core.stream.XmlH
 import org.apache.axiom.core.stream.sax.XmlHandlerContentHandler;
 import org.apache.axiom.core.stream.stax.StAXPivot;
 import org.apache.axiom.core.stream.stax.XMLStreamWriterNamespaceContextProvider;
-import org.apache.axiom.om.NodeUnavailableException;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.OMSerializable;
-import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.OMXMLStreamReaderConfiguration;
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
@@ -141,47 +139,10 @@ public aspect AxiomContainerSupport {
     }
 
     public void AxiomContainer.addChild(OMNode omNode) {
-        AxiomChildNode child = prepareNewChild(omNode);
-        
-        coreAppendChild(child);
-
-        // For a normal OMNode, the incomplete status is
-        // propogated up the tree.  
-        // However, a OMSourcedElement is self-contained 
-        // (it has an independent parser source).
-        // So only propogate the incomplete setting if this
-        // is a normal OMNode
-        // TODO: this is crap and needs to be reviewed
-        if (!child.isComplete() && 
-            !(child instanceof OMSourcedElement)) {
-            setComplete(false);
-        }
-    }
-    
-    public final void AxiomContainer.build() {
-        Builder builder = coreGetBuilder();
-        // builder is null. Meaning this is a programatical created element but it has children which are not completed
-        // Build them all.
-        if (builder == null && getState() == INCOMPLETE) {
-            for (Iterator<OMNode> childrenIterator = getChildren(); childrenIterator.hasNext();) {
-                OMNode omNode = childrenIterator.next();
-                omNode.build();
-            }
-        } else {
-            if (getState() == AxiomContainer.DISCARDING || getState() == AxiomContainer.DISCARDED) {
-                throw new NodeUnavailableException();
-            }
-            if (builder != null && builder.isCompleted()) {
-                log.debug("Builder is already complete.");
-            }
-            while (!isComplete()) {
-    
-                builder.next();    
-                if (builder.isCompleted() && !isComplete()) {
-                    log.debug("Builder is complete.  Setting OMObject to complete.");
-                    setComplete(true);
-                }
-            }
+        try {
+            coreAppendChild(prepareNewChild(omNode));
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
         }
     }
     
@@ -194,7 +155,11 @@ public aspect AxiomContainerSupport {
     }
     
     public void AxiomContainer.removeChildren() {
-        coreRemoveChildren(AxiomSemantics.INSTANCE);
+        try {
+            coreRemoveChildren(AxiomSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
     }
     
     private static final Mapper<CoreNode,OMNode> childrenMapper = new Mapper<CoreNode,OMNode>() {
@@ -352,18 +317,6 @@ public aspect AxiomContainerSupport {
         serialize(writer, format, false);
     }
 
-    public final void AxiomContainer.notifyChildComplete() {
-        if (getState() == INCOMPLETE && coreGetBuilder() == null) {
-            for (Iterator<OMNode> iterator = getChildren(); iterator.hasNext(); ) {
-                OMNode node = iterator.next();
-                if (!node.isComplete()) {
-                    return;
-                }
-            }
-            this.setComplete(true);
-        }
-    }
-
     public final void AxiomContainer.close(boolean build) {
         Builder builder = coreGetBuilder();
         if (build) {
@@ -374,4 +327,9 @@ public aspect AxiomContainerSupport {
             builder.close();
         }
     }
+
+    // TODO: overridden in AxiomSourcedElementSupport
+    public void AxiomContainer.setComplete(boolean complete) {
+        coreSetState(complete ? COMPLETE : INCOMPLETE);
+    }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCoreParentNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCoreParentNodeSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCoreParentNodeSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCoreParentNodeSupport.aj Fri Mar 11 22:59:45 2016
@@ -18,11 +18,62 @@
  */
 package org.apache.axiom.om.impl.mixin;
 
+import org.apache.axiom.core.CoreChildNode;
+import org.apache.axiom.core.CoreModelException;
+import org.apache.axiom.om.NodeUnavailableException;
+import org.apache.axiom.om.impl.common.AxiomExceptionTranslator;
 import org.apache.axiom.om.impl.intf.AxiomCoreParentNode;
+import org.apache.axiom.om.impl.intf.AxiomSerializable;
+import org.apache.axiom.om.impl.intf.AxiomSourcedElement;
 
 public aspect AxiomCoreParentNodeSupport {
     public final boolean AxiomCoreParentNode.isComplete() {
-        int state = getState();
-        return state == COMPLETE || state == COMPACT;
+        try {
+            switch (getState()) {
+                case COMPACT:
+                    return true;
+                case COMPLETE:
+                    CoreChildNode child = coreGetFirstChild();
+                    while (child != null) {
+                        if (!(child instanceof AxiomSourcedElement || ((AxiomSerializable)child).isComplete())) {
+                            return false;
+                        }
+                        child = child.coreGetNextSibling();
+                    }
+                    return true;
+                default:
+                    return false;
+            }
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
+    }
+    
+    public final void AxiomCoreParentNode.build() {
+        try {
+            switch (getState()) {
+                case DISCARDING:
+                case DISCARDED:
+                    throw new NodeUnavailableException();
+                case COMPLETE:
+                case INCOMPLETE:
+                    // First do the children that have already been created; only they need recursion.
+                    CoreChildNode child = coreGetFirstChildIfAvailable();
+                    while (child != null) {
+                        // Historically, Axiom skipped OMSourcedElements in the tree. Quote: "The
+                        // OMSourcedElement has its own isolated builder/reader during the
+                        // expansion process."
+                        if (!(child instanceof AxiomSourcedElement)) {
+                            ((AxiomSerializable)child).build();
+                        }
+                        child = child.coreGetNextSibling();
+                    }
+                    // Now build the parent; no need to recurse because all descendants will also be
+                    // complete.
+                    coreBuild();
+            }
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
     }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj Fri Mar 11 22:59:45 2016
@@ -86,10 +86,6 @@ public aspect AxiomDocumentSupport {
         coreSetStandalone("yes".equalsIgnoreCase(standalone));
     }
 
-    public final void AxiomDocument.setComplete(boolean complete) {
-        coreSetState(complete ? COMPLETE : INCOMPLETE);
-    }
-
     public final void AxiomDocument.checkChild(OMNode child) {
         if (child instanceof OMElement) {
             if (getOMDocumentElement() != null) {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj Fri Mar 11 22:59:45 2016
@@ -60,7 +60,6 @@ import org.apache.axiom.om.impl.common.N
 import org.apache.axiom.om.impl.common.NamespaceIterator;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 import org.apache.axiom.om.impl.intf.AxiomAttribute;
-import org.apache.axiom.om.impl.intf.AxiomContainer;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.om.impl.intf.AxiomNamespaceDeclaration;
 import org.apache.axiom.om.impl.intf.Sequence;
@@ -230,7 +229,11 @@ public aspect AxiomElementSupport {
     
     // Not final because overridden in Abdera
     public void AxiomElement.setText(String text) {
-        coreSetCharacterData(text, AxiomSemantics.INSTANCE);
+        try {
+            coreSetCharacterData(text, AxiomSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
     }
 
     public final void AxiomElement.setText(QName qname) {
@@ -540,18 +543,6 @@ public aspect AxiomElementSupport {
         return sw.toString();
     }
 
-    public void AxiomElement.setComplete(boolean complete) {
-        coreSetState(complete ? COMPLETE : INCOMPLETE);
-        AxiomContainer parent = (AxiomContainer)coreGetParent();
-        if (parent != null) {
-            if (!complete) {
-                parent.setComplete(false);
-            } else {
-                parent.notifyChildComplete();
-            }
-        }
-    }
-
     public final OMElement AxiomElement.cloneOMElement() {
         return (OMElement)clone(null);
     }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamespaceDeclarationSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamespaceDeclarationSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamespaceDeclarationSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomNamespaceDeclarationSupport.aj Fri Mar 11 22:59:45 2016
@@ -49,8 +49,12 @@ public aspect AxiomNamespaceDeclarationS
     }
     
     public final void AxiomNamespaceDeclaration.setDeclaredNamespace(OMNamespace declaredNamespace) {
-        this.declaredNamespace = declaredNamespace;
-        coreSetCharacterData(declaredNamespace.getNamespaceURI(), AxiomSemantics.INSTANCE);
+        try {
+            this.declaredNamespace = declaredNamespace;
+            coreSetCharacterData(declaredNamespace.getNamespaceURI(), AxiomSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
     }
     
     public final void AxiomNamespaceDeclaration.build() {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomProcessingInstructionSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomProcessingInstructionSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomProcessingInstructionSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomProcessingInstructionSupport.aj Fri Mar 11 22:59:45 2016
@@ -44,7 +44,11 @@ public aspect AxiomProcessingInstruction
     }
 
     public final void AxiomProcessingInstruction.setValue(String value) {
-        coreSetCharacterData(value, AxiomSemantics.INSTANCE);
+        try {
+            coreSetCharacterData(value, AxiomSemantics.INSTANCE);
+        } catch (CoreModelException ex) {
+            throw AxiomExceptionTranslator.translate(ex);
+        }
     }
 
     public final void AxiomProcessingInstruction.serialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
@@ -57,8 +61,4 @@ public aspect AxiomProcessingInstruction
     
     public final void AxiomProcessingInstruction.buildWithAttachments() {
     }
-    
-    public final void AxiomProcessingInstruction.build() {
-        // TODO
-    }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj Fri Mar 11 22:59:45 2016
@@ -471,14 +471,8 @@ public aspect AxiomSourcedElementSupport
         }
     }
 
-    /**
-     * setComplete override The OMSourcedElement has its own isolated builder/reader during the
-     * expansion process. Thus calls to setCompete should stop here and not propogate up to the
-     * parent (which may have a different builder or no builder).
-     */
-    public void AxiomSourcedElement.setComplete(boolean complete) {
-        coreSetState(complete ? COMPLETE : INCOMPLETE);
-        if (complete && dataSource != null) {
+    public void AxiomSourcedElement.completed() {
+        if (dataSource != null) {
             if (dataSource instanceof OMDataSourceExt) {
                 ((OMDataSourceExt)dataSource).close();
             }

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=1734640&r1=1734639&r2=1734640&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 Fri Mar 11 22:59:45 2016
@@ -38,15 +38,19 @@ public abstract class ParentNode extends
     // /
 
     public final Node appendChild(Node newChild) throws DOMException {
-        checkNewChild(newChild, null);
-        if (newChild instanceof CoreChildNode) {
-            coreAppendChild((CoreChildNode)newChild);
-        } else if (newChild instanceof CoreDocumentFragment) {
-            coreAppendChildren((CoreDocumentFragment)newChild);
-        } else {
-            throw newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
+        try {
+            checkNewChild(newChild, null);
+            if (newChild instanceof CoreChildNode) {
+                coreAppendChild((CoreChildNode)newChild);
+            } else if (newChild instanceof CoreDocumentFragment) {
+                coreAppendChildren((CoreDocumentFragment)newChild);
+            } else {
+                throw newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
+            }
+            return newChild;
+        } catch (CoreModelException ex) {
+            throw DOMExceptionUtil.toUncheckedException(ex);
         }
-        return newChild;
     }
 
     private void checkNewChild(Node newChild, Node replacedChild) {

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMContent.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMContent.java (original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMContent.java Fri Mar 11 22:59:45 2016
@@ -35,6 +35,7 @@ import org.apache.abdera.model.Element;
 import org.apache.abdera.model.ElementWrapper;
 import org.apache.abdera.util.Constants;
 import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.fom.AbderaContent;
 import org.apache.axiom.fom.AbderaElement;
 import org.apache.axiom.fom.FOMSemantics;
@@ -85,33 +86,37 @@ public class FOMContent extends FOMExten
     }
 
     public <T extends Element> Content setValueElement(T value) {
-        if (value != null) {
-            if (this.getFirstElement() != null)
-                this.getFirstElement().discard();
-
-            MimeType mtype = this.getMimeType();
-            if (mtype == null) {
-                String mt = getFactory().getMimeType(value);
-                if (mt != null) {
-                    setMimeType(mt);
-                    mtype = getMimeType();
-                }
-            }
-
-            if (value instanceof Div && !getContentType().equals(Content.Type.XML))
-                setContentType(Content.Type.XHTML);
-            else {
+        try {
+            if (value != null) {
+                if (this.getFirstElement() != null)
+                    this.getFirstElement().discard();
+    
+                MimeType mtype = this.getMimeType();
                 if (mtype == null) {
-                    setContentType(Content.Type.XML);
+                    String mt = getFactory().getMimeType(value);
+                    if (mt != null) {
+                        setMimeType(mt);
+                        mtype = getMimeType();
+                    }
+                }
+    
+                if (value instanceof Div && !getContentType().equals(Content.Type.XML))
+                    setContentType(Content.Type.XHTML);
+                else {
+                    if (mtype == null) {
+                        setContentType(Content.Type.XML);
+                    }
                 }
+                AbderaElement el = (AbderaElement)(value instanceof ElementWrapper ? ((ElementWrapper)value).getInternal() : value);
+                removeChildren();
+                _addChild(el);
+            } else {
+                coreRemoveChildren(FOMSemantics.INSTANCE);
             }
-            AbderaElement el = (AbderaElement)(value instanceof ElementWrapper ? ((ElementWrapper)value).getInternal() : value);
-            removeChildren();
-            _addChild(el);
-        } else {
-            coreRemoveChildren(FOMSemantics.INSTANCE);
+            return this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
         }
-        return this;
     }
 
     public MimeType getMimeType() {
@@ -169,17 +174,21 @@ public class FOMContent extends FOMExten
     }
 
     public Content setDataHandler(DataHandler dataHandler) {
-        if (!Type.MEDIA.equals(getContentType()))
-            throw new IllegalArgumentException();
-        if (dataHandler.getContentType() != null) {
-            try {
-                setMimeType(dataHandler.getContentType());
-            } catch (Exception e) {
+        try {
+            if (!Type.MEDIA.equals(getContentType()))
+                throw new IllegalArgumentException();
+            if (dataHandler.getContentType() != null) {
+                try {
+                    setMimeType(dataHandler.getContentType());
+                } catch (Exception e) {
+                }
             }
+            coreRemoveChildren(FOMSemantics.INSTANCE);
+            addChild(getOMFactory().createOMText(dataHandler, true));
+            return this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
         }
-        coreRemoveChildren(FOMSemantics.INSTANCE);
-        addChild(getOMFactory().createOMText(dataHandler, true));
-        return this;
     }
 
     public String getValue() {
@@ -204,19 +213,23 @@ public class FOMContent extends FOMExten
     }
 
     public <T extends Element> T setText(Content.Type type, String value) {
-        setContentType(type);
-        if (value != null) {
-            OMNode child = this.getFirstOMChild();
-            while (child != null) {
-                if (child.getType() == OMNode.TEXT_NODE) {
-                    child.detach();
+        try {
+            setContentType(type);
+            if (value != null) {
+                OMNode child = this.getFirstOMChild();
+                while (child != null) {
+                    if (child.getType() == OMNode.TEXT_NODE) {
+                        child.detach();
+                    }
+                    child = child.getNextOMSibling();
                 }
-                child = child.getNextOMSibling();
-            }
-            getOMFactory().createOMText(this, value);
-        } else
-            coreRemoveChildren(FOMSemantics.INSTANCE);
-        return (T)this;
+                getOMFactory().createOMText(this, value);
+            } else
+                coreRemoveChildren(FOMSemantics.INSTANCE);
+            return (T)this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
+        }
     }
 
     // TODO: the AspectJ compiler doesn't like this
@@ -225,55 +238,59 @@ public class FOMContent extends FOMExten
 //    }
 
     public Content setValue(String value) {
-        if (value != null)
-            removeAttribute(SRC);
-        if (value != null) {
-            Type type = getContentType();
-            if (Type.TEXT.equals(type)) {
-                coreRemoveChildren(FOMSemantics.INSTANCE);
-                setText(type, value);
-            } else if (Type.HTML.equals(type)) {
-                coreRemoveChildren(FOMSemantics.INSTANCE);
-                setText(type, value);
-            } else if (Type.XHTML.equals(type)) {
-                IRI baseUri = null;
-                Element element = null;
-                value = "<div xmlns=\"" + XHTML_NS + "\">" + value + "</div>";
-                try {
-                    baseUri = getResolvedBaseUri();
-                    element = _parse(value, baseUri);
-                } catch (Exception e) {
-                }
-                if (element != null && element instanceof Div)
-                    setValueElement((Div)element);
-            } else if (Type.XML.equals(type)) {
-                IRI baseUri = null;
-                Element element = null;
-                try {
-                    baseUri = getResolvedBaseUri();
-                    element = _parse(value, baseUri);
-                } catch (Exception e) {
-                }
-                if (element != null)
-                    setValueElement(element);
-                try {
-                    if (getMimeType() == null)
-                        setMimeType("application/xml");
-                } catch (Exception e) {
+        try {
+            if (value != null)
+                removeAttribute(SRC);
+            if (value != null) {
+                Type type = getContentType();
+                if (Type.TEXT.equals(type)) {
+                    coreRemoveChildren(FOMSemantics.INSTANCE);
+                    setText(type, value);
+                } else if (Type.HTML.equals(type)) {
+                    coreRemoveChildren(FOMSemantics.INSTANCE);
+                    setText(type, value);
+                } else if (Type.XHTML.equals(type)) {
+                    IRI baseUri = null;
+                    Element element = null;
+                    value = "<div xmlns=\"" + XHTML_NS + "\">" + value + "</div>";
+                    try {
+                        baseUri = getResolvedBaseUri();
+                        element = _parse(value, baseUri);
+                    } catch (Exception e) {
+                    }
+                    if (element != null && element instanceof Div)
+                        setValueElement((Div)element);
+                } else if (Type.XML.equals(type)) {
+                    IRI baseUri = null;
+                    Element element = null;
+                    try {
+                        baseUri = getResolvedBaseUri();
+                        element = _parse(value, baseUri);
+                    } catch (Exception e) {
+                    }
+                    if (element != null)
+                        setValueElement(element);
+                    try {
+                        if (getMimeType() == null)
+                            setMimeType("application/xml");
+                    } catch (Exception e) {
+                    }
+                } else if (Type.MEDIA.equals(type)) {
+                    coreRemoveChildren(FOMSemantics.INSTANCE);
+                    setText(type, value);
+                    try {
+                        if (getMimeType() == null)
+                            setMimeType("text/plain");
+                    } catch (Exception e) {
+                    }
                 }
-            } else if (Type.MEDIA.equals(type)) {
+            } else {
                 coreRemoveChildren(FOMSemantics.INSTANCE);
-                setText(type, value);
-                try {
-                    if (getMimeType() == null)
-                        setMimeType("text/plain");
-                } catch (Exception e) {
-                }
             }
-        } else {
-            coreRemoveChildren(FOMSemantics.INSTANCE);
+            return this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
         }
-        return this;
     }
 
     public String getWrappedValue() {

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java (original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java Fri Mar 11 22:59:45 2016
@@ -30,6 +30,7 @@ import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Div;
+import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.fom.AbderaDiv;
 import org.apache.axiom.fom.FOMSemantics;
 import org.apache.axiom.om.OMElement;
@@ -82,19 +83,23 @@ public class FOMDiv extends FOMExtensibl
     }
 
     public void setValue(String value) {
-        coreRemoveChildren(FOMSemantics.INSTANCE);
-        if (value != null) {
-            IRI baseUri = null;
-            value = "<div xmlns=\"" + XHTML_NS + "\">" + value + "</div>";
-            OMElement element = null;
-            try {
-                baseUri = getResolvedBaseUri();
-                element = (OMElement)_parse(value, baseUri);
-            } catch (Exception e) {
-            }
-            for (Iterator<?> i = element.getChildren(); i.hasNext();) {
-                this.addChild((OMNode)i.next());
+        try {
+            coreRemoveChildren(FOMSemantics.INSTANCE);
+            if (value != null) {
+                IRI baseUri = null;
+                value = "<div xmlns=\"" + XHTML_NS + "\">" + value + "</div>";
+                OMElement element = null;
+                try {
+                    baseUri = getResolvedBaseUri();
+                    element = (OMElement)_parse(value, baseUri);
+                } catch (Exception e) {
+                }
+                for (Iterator<?> i = element.getChildren(); i.hasNext();) {
+                    this.addChild((OMNode)i.next());
+                }
             }
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
         }
     }
 

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java (original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java Fri Mar 11 22:59:45 2016
@@ -82,7 +82,11 @@ import org.apache.axiom.om.impl.intf.Axi
 public class FOMElement extends FOMChildNode implements AbderaElement, AxiomElement {
     // Overridden in subclasses!
     public void _addChild(AbderaElement element) {
-        coreAppendChild(element);
+        try {
+            coreAppendChild(element);
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
+        }
     }
     
     protected void setParentDocument(Document parent) {
@@ -218,12 +222,16 @@ public class FOMElement extends FOMChild
     }
 
     public <T extends Element> T setAttributeValue(QName qname, String value) {
-        if (value == null) {
-            coreRemoveAttribute(FOMSemantics.ATTRIBUTE_MATCHER, qname.getNamespaceURI(), qname.getLocalPart(), FOMSemantics.INSTANCE);
-        } else {
-            coreSetAttribute(FOMSemantics.ATTRIBUTE_MATCHER, qname.getNamespaceURI(), qname.getLocalPart(), qname.getPrefix(), value);
+        try {
+            if (value == null) {
+                coreRemoveAttribute(FOMSemantics.ATTRIBUTE_MATCHER, qname.getNamespaceURI(), qname.getLocalPart(), FOMSemantics.INSTANCE);
+            } else {
+                coreSetAttribute(FOMSemantics.ATTRIBUTE_MATCHER, qname.getNamespaceURI(), qname.getLocalPart(), qname.getPrefix(), value);
+            }
+            return (T)this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
         }
-        return (T)this;
     }
 
     private static final IdentityMapper<AbderaElement> abderaElementMapper = new IdentityMapper<AbderaElement>();
@@ -258,13 +266,17 @@ public class FOMElement extends FOMChild
     }
 
     public void _setChild(QName qname, Element element) {
-        AbderaElement e = _getFirstChildWithName(qname);
-        if (e == null && element != null) {
-            coreAppendChild((AbderaElement)element);
-        } else if (e != null && element != null) {
-            e.coreReplaceWith((AbderaElement)element, FOMSemantics.INSTANCE);
-        } else if (e != null && element == null) {
-            e.coreDetach(FOMSemantics.INSTANCE);
+        try {
+            AbderaElement e = _getFirstChildWithName(qname);
+            if (e == null && element != null) {
+                coreAppendChild((AbderaElement)element);
+            } else if (e != null && element != null) {
+                e.coreReplaceWith((AbderaElement)element, FOMSemantics.INSTANCE);
+            } else if (e != null && element == null) {
+                e.coreDetach(FOMSemantics.INSTANCE);
+            }
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
         }
     }
 
@@ -372,18 +384,22 @@ public class FOMElement extends FOMChild
     }
 
     public void setText(String text) {
-        if (text != null) {
-            OMNode child = this.getFirstOMChild();
-            while (child != null) {
-                if (child.getType() == OMNode.TEXT_NODE) {
-                    child.detach();
+        try {
+            if (text != null) {
+                OMNode child = this.getFirstOMChild();
+                while (child != null) {
+                    if (child.getType() == OMNode.TEXT_NODE) {
+                        child.detach();
+                    }
+                    child = child.getNextOMSibling();
                 }
-                child = child.getNextOMSibling();
-            }
-            getOMFactory().createOMText(this, text);
-        } else
-            coreRemoveChildren(FOMSemantics.INSTANCE);
-        // return (T)this;
+                getOMFactory().createOMText(this, text);
+            } else
+                coreRemoveChildren(FOMSemantics.INSTANCE);
+            // return (T)this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
+        }
     }
 
     public String getText() {
@@ -649,9 +665,13 @@ public class FOMElement extends FOMChild
     }
 
     public <T extends Element> T setText(DataHandler handler) {
-        coreRemoveChildren(FOMSemantics.INSTANCE);
-        addChild(getOMFactory().createOMText(handler, true));
-        return (T)this;
+        try {
+            coreRemoveChildren(FOMSemantics.INSTANCE);
+            addChild(getOMFactory().createOMText(handler, true));
+            return (T)this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
+        }
     }
 
     public WriterOptions getDefaultWriterOptions() {

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java?rev=1734640&r1=1734639&r2=1734640&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java (original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java Fri Mar 11 22:59:45 2016
@@ -27,6 +27,7 @@ import org.apache.abdera.model.Div;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Text;
 import org.apache.abdera.util.Constants;
+import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.fom.AbderaDiv;
 import org.apache.axiom.fom.AbderaText;
 import org.apache.axiom.fom.FOMSemantics;
@@ -68,15 +69,19 @@ public class FOMText extends FOMElement
     }
 
     public Text setValueElement(Div value) {
-        if (value != null) {
-            if (_getFirstChildWithName(Constants.DIV) != null)
-                _getFirstChildWithName(Constants.DIV).discard();
-            setTextType(Text.Type.XHTML);
-            removeChildren();
-            _addChild((AbderaDiv)value);
-        } else
-            coreRemoveChildren(FOMSemantics.INSTANCE);
-        return this;
+        try {
+            if (value != null) {
+                if (_getFirstChildWithName(Constants.DIV) != null)
+                    _getFirstChildWithName(Constants.DIV).discard();
+                setTextType(Text.Type.XHTML);
+                removeChildren();
+                _addChild((AbderaDiv)value);
+            } else
+                coreRemoveChildren(FOMSemantics.INSTANCE);
+            return this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
+        }
     }
 
     public String getValue() {
@@ -99,43 +104,51 @@ public class FOMText extends FOMElement
 //    }
 
     public <T extends Element> T setText(Text.Type type, String value) {
-        setTextType(type);
-        if (value != null) {
-            OMNode child = this.getFirstOMChild();
-            while (child != null) {
-                if (child.getType() == OMNode.TEXT_NODE) {
-                    child.detach();
+        try {
+            setTextType(type);
+            if (value != null) {
+                OMNode child = this.getFirstOMChild();
+                while (child != null) {
+                    if (child.getType() == OMNode.TEXT_NODE) {
+                        child.detach();
+                    }
+                    child = child.getNextOMSibling();
                 }
-                child = child.getNextOMSibling();
-            }
-            getOMFactory().createOMText(this, value);
-        } else
-            coreRemoveChildren(FOMSemantics.INSTANCE);
-        return (T)this;
+                getOMFactory().createOMText(this, value);
+            } else
+                coreRemoveChildren(FOMSemantics.INSTANCE);
+            return (T)this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
+        }
     }
 
     public Text setValue(String value) {
-        if (value != null) {
-            Type type = getTextType();
-            if (Type.TEXT.equals(type)) {
-                setText(type, value);
-            } else if (Type.HTML.equals(type)) {
-                setText(type, value);
-            } else if (Type.XHTML.equals(type)) {
-                IRI baseUri = null;
-                value = "<div xmlns=\"" + XHTML_NS + "\">" + value + "</div>";
-                Element element = null;
-                try {
-                    baseUri = getResolvedBaseUri();
-                    element = _parse(value, baseUri);
-                } catch (Exception e) {
+        try {
+            if (value != null) {
+                Type type = getTextType();
+                if (Type.TEXT.equals(type)) {
+                    setText(type, value);
+                } else if (Type.HTML.equals(type)) {
+                    setText(type, value);
+                } else if (Type.XHTML.equals(type)) {
+                    IRI baseUri = null;
+                    value = "<div xmlns=\"" + XHTML_NS + "\">" + value + "</div>";
+                    Element element = null;
+                    try {
+                        baseUri = getResolvedBaseUri();
+                        element = _parse(value, baseUri);
+                    } catch (Exception e) {
+                    }
+                    if (element != null && element instanceof Div)
+                        setValueElement((Div)element);
                 }
-                if (element != null && element instanceof Div)
-                    setValueElement((Div)element);
-            }
-        } else
-            coreRemoveChildren(FOMSemantics.INSTANCE);
-        return this;
+            } else
+                coreRemoveChildren(FOMSemantics.INSTANCE);
+            return this;
+        } catch (CoreModelException ex) {
+            throw FOMSemantics.INSTANCE.toUncheckedException(ex);
+        }
     }
 
     public String getWrappedValue() {



Mime
View raw message