ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1381097 - /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/
Date Wed, 05 Sep 2012 09:25:56 GMT
Author: veithen
Date: Wed Sep  5 09:25:55 2012
New Revision: 1381097

URL: http://svn.apache.org/viewvc?rev=1381097&view=rev
Log:
Simplified exception handling.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMUtil.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamedNodeHelper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
Wed Sep  5 09:25:55 2012
@@ -323,10 +323,7 @@ public class AttrImpl extends RootNode i
 
     final void checkInUse() {
         if (owner instanceof ElementImpl) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN, DOMException.INUSE_ATTRIBUTE_ERR,
-                    null);
-            throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, msg);
+            throw DOMUtil.newDOMException(DOMException.INUSE_ATTRIBUTE_ERR);
         }
     }
 

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
Wed Sep  5 09:25:55 2012
@@ -77,9 +77,7 @@ public class AttributeMap implements Nam
 
         int i = findNamePoint(name, 0);
         if (i < 0) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null);
-            throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
+            throw DOMUtil.newDOMException(DOMException.NOT_FOUND_ERR);
         }
 
         NodeImpl n = (NodeImpl) nodes.elementAt(i);
@@ -93,9 +91,7 @@ public class AttributeMap implements Nam
 
         int i = findNamePoint(namespaceURI, name);
         if (i < 0) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null);
-            throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
+            throw DOMUtil.newDOMException(DOMException.NOT_FOUND_ERR);
         }
 
         NodeImpl n = (NodeImpl) nodes.elementAt(i);
@@ -109,11 +105,7 @@ public class AttributeMap implements Nam
 
         ownerNode.checkSameOwnerDocument(attribute);
         if (attribute.getNodeType() != Node.ATTRIBUTE_NODE) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN,
-                    DOMException.HIERARCHY_REQUEST_ERR,
-                    null);
-            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, msg);
+            throw DOMUtil.newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
         }
 
         AttrImpl attr = (AttrImpl) attribute;
@@ -121,10 +113,7 @@ public class AttributeMap implements Nam
             if (attr.getOwnerElement() != this.ownerNode) // the owner must be
                 // the owner of this
                 // list
-                throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR,
-                                       DOMMessageFormatter.formatMessage(
-                                               DOMMessageFormatter.DOM_DOMAIN,
-                                               DOMException.INUSE_ATTRIBUTE_ERR, null));
+                throw DOMUtil.newDOMException(DOMException.INUSE_ATTRIBUTE_ERR);
             else
                 return attr; // No point adding the 'same' attr again to the
             // same element
@@ -166,20 +155,14 @@ public class AttributeMap implements Nam
     /** Almost a copy of the Xerces impl. */
     Node setAttribute(Node attribute, boolean useDomSemantics) throws DOMException {
         if (attribute.getNodeType() != Node.ATTRIBUTE_NODE) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR,
-                    null);
-            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, msg);
+            throw DOMUtil.newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
         }
 
         AttrImpl attr = (AttrImpl) attribute;
         if (attr.getOwnerElement() != null) { // If the attribute is owned then:
             //the owner must be the owner of this list
             if (attr.getOwnerElement() != this.ownerNode)
-                throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR,
-                                       DOMMessageFormatter.formatMessage(
-                                               DOMMessageFormatter.DOM_DOMAIN,
-                                               DOMException.INUSE_ATTRIBUTE_ERR, null));
+                throw DOMUtil.newDOMException(DOMException.INUSE_ATTRIBUTE_ERR);
             else
                 return attr; // No point adding the 'same' attr again to the
             // same element

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java
Wed Sep  5 09:25:55 2012
@@ -62,10 +62,7 @@ public abstract class CharacterImpl exte
 
         int length = this.textValue.length();
         if (offset < 0 || offset > length - 1 || count < 0) {
-            throw new DOMException(DOMException.INDEX_SIZE_ERR,
-                                   DOMMessageFormatter.formatMessage(
-                                           DOMMessageFormatter.DOM_DOMAIN, DOMException.INDEX_SIZE_ERR,
-                                           null));
+            throw DOMUtil.newDOMException(DOMException.INDEX_SIZE_ERR);
         } else {
 
             int end = Math.min(count + offset, length);
@@ -90,10 +87,7 @@ public abstract class CharacterImpl exte
         int length = this.getLength();
 
         if (offset < 0 || offset > length - 1) {
-            throw new DOMException(DOMException.INDEX_SIZE_ERR,
-                                   DOMMessageFormatter.formatMessage(
-                                           DOMMessageFormatter.DOM_DOMAIN,
-                                           DOMException.INDEX_SIZE_ERR, null));
+            throw DOMUtil.newDOMException(DOMException.INDEX_SIZE_ERR);
         }
 
         this.textValue = (new StringBuilder(textValue)).insert(offset, data).toString();
@@ -112,10 +106,7 @@ public abstract class CharacterImpl exte
      */
     public String substringData(int offset, int count) throws DOMException {
         if (offset < 0 || offset > this.getLength() || count < 0) {
-            throw new DOMException(DOMException.INDEX_SIZE_ERR,
-                                   DOMMessageFormatter.formatMessage(
-                                           DOMMessageFormatter.DOM_DOMAIN,
-                                           DOMException.INDEX_SIZE_ERR, null));
+            throw DOMUtil.newDOMException(DOMException.INDEX_SIZE_ERR);
         }
 
         int end = Math.min(count + offset, textValue.length());

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMUtil.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMUtil.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMUtil.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMUtil.java
Wed Sep  5 09:25:55 2012
@@ -19,6 +19,8 @@
 
 package org.apache.axiom.om.impl.dom;
 
+import org.w3c.dom.DOMException;
+
 /** Utility class for the OM-DOM implementation */
 class DOMUtil {
 
@@ -62,4 +64,9 @@ class DOMUtil {
         int idx = qualifiedName.indexOf(':');
         return idx == -1 ? null : qualifiedName.substring(0, idx);
     }
+    
+    public static DOMException newDOMException(short code) {
+        throw new DOMException(code, DOMMessageFormatter.formatMessage(
+                DOMMessageFormatter.DOM_DOMAIN, code, null));
+    }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
Wed Sep  5 09:25:55 2012
@@ -122,10 +122,7 @@ public class DocumentImpl extends RootNo
 
     public Attr createAttribute(String name) throws DOMException {
         if (!DOMUtil.isQualifiedName(name)) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN, DOMException.INVALID_CHARACTER_ERR,
-                    null);
-            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
+            throw DOMUtil.newDOMException(DOMException.INVALID_CHARACTER_ERR);
         }
         return new AttrImpl(this, name, this.factory);
     }
@@ -346,12 +343,8 @@ public class DocumentImpl extends RootNo
                 throw new UnsupportedOperationException("TODO : Implement handling of org.w3c.dom.Node
type == " + type );
 
             case Node.DOCUMENT_NODE: // Can't import document nodes
-            default: { // Unknown node type
-                String msg = DOMMessageFormatter.formatMessage(
-                        DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_SUPPORTED_ERR, null);
-                throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
-            }
-
+            default:
+                throw DOMUtil.newDOMException(DOMException.NOT_SUPPORTED_ERR);
         }
 
         // If deep, replicate and attach the kids.
@@ -468,11 +461,7 @@ public class DocumentImpl extends RootNo
         // check that both prefix and local part match NCName
         if ((prefix != null && !XMLChar.isValidNCName(prefix))
                 || !XMLChar.isValidNCName(local)) {
-            // REVISIT: add qname parameter to the message
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN, DOMException.INVALID_CHARACTER_ERR,
-                    null);
-            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
+            throw DOMUtil.newDOMException(DOMException.INVALID_CHARACTER_ERR);
         }
     }
 

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
Wed Sep  5 09:25:55 2012
@@ -278,9 +278,7 @@ public class ElementImpl extends ParentN
      */
     public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
         if (oldAttr.getOwnerElement() != this) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR, null);
-            throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
+            throw DOMUtil.newDOMException(DOMException.NOT_FOUND_ERR);
         }
         attributes.remove((AttrImpl)oldAttr, true);
         return oldAttr;
@@ -394,10 +392,7 @@ public class ElementImpl extends ParentN
     public void setAttribute(String name, String value) throws DOMException {
         // Check for invalid charaters
         if (!DOMUtil.isQualifiedName(name)) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN, DOMException.INVALID_CHARACTER_ERR,
-                    null);
-            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
+            throw DOMUtil.newDOMException(DOMException.INVALID_CHARACTER_ERR);
         }
         if (name.startsWith(XMLConstants.XMLNS_ATTRIBUTE + ":")) {
             // This is a ns declaration
@@ -1051,11 +1046,7 @@ public class ElementImpl extends ParentN
         //find the attr
         AttrImpl tempAttr = (AttrImpl) this.getAttributeNode(name);
         if (tempAttr == null) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN,
-                    DOMException.NOT_FOUND_ERR, null);
-            throw new DOMException(DOMException.NOT_FOUND_ERR,
-                                   msg);
+            throw DOMUtil.newDOMException(DOMException.NOT_FOUND_ERR);
         }
 
         this.updateIsId(isId, tempAttr);
@@ -1066,11 +1057,7 @@ public class ElementImpl extends ParentN
         //find the attr
         AttrImpl tempAttr = (AttrImpl) this.getAttributeNodeNS(namespaceURI, localName);
         if (tempAttr == null) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN,
-                    DOMException.NOT_FOUND_ERR, null);
-            throw new DOMException(DOMException.NOT_FOUND_ERR,
-                                   msg);
+            throw DOMUtil.newDOMException(DOMException.NOT_FOUND_ERR);
         }
 
         this.updateIsId(isId, tempAttr);
@@ -1089,11 +1076,7 @@ public class ElementImpl extends ParentN
         }
 
         if (tempAttr == null) {
-            String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.DOM_DOMAIN,
-                    DOMException.NOT_FOUND_ERR, null);
-            throw new DOMException(DOMException.NOT_FOUND_ERR,
-                                   msg);
+            throw DOMUtil.newDOMException(DOMException.NOT_FOUND_ERR);
         }
 
         this.updateIsId(isId, tempAttr);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java
Wed Sep  5 09:25:55 2012
@@ -70,30 +70,19 @@ public abstract class LeafNode extends N
     }
 
     public final Node appendChild(Node newChild) throws DOMException {
-        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
-                DOMMessageFormatter.formatMessage(
-                        DOMMessageFormatter.DOM_DOMAIN,
-                        DOMException.HIERARCHY_REQUEST_ERR, null));
+        throw DOMUtil.newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
     }
 
     public final Node removeChild(Node oldChild) throws DOMException {
-        throw new DOMException(DOMException.NOT_FOUND_ERR, DOMMessageFormatter
-                .formatMessage(DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR,
-                               null));
+        throw DOMUtil.newDOMException(DOMException.NOT_FOUND_ERR);
     }
 
     public final Node insertBefore(Node newChild, Node refChild) throws DOMException {
-        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
-                               DOMMessageFormatter.formatMessage(
-                                       DOMMessageFormatter.DOM_DOMAIN,
-                                       DOMException.HIERARCHY_REQUEST_ERR, null));
+        throw DOMUtil.newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
     }
 
     public final Node replaceChild(Node newChild, Node oldChild) throws DOMException {
-        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
-                               DOMMessageFormatter.formatMessage(
-                                       DOMMessageFormatter.DOM_DOMAIN,
-                                       DOMException.HIERARCHY_REQUEST_ERR, null));
+        throw DOMUtil.newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
     }
 
     final NodeImpl clone(OMCloneOptions options, ParentNode targetParent, boolean deep, boolean
namespaceRepairing) {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamedNodeHelper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamedNodeHelper.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamedNodeHelper.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamedNodeHelper.java
Wed Sep  5 09:25:55 2012
@@ -32,11 +32,7 @@ public final class NamedNodeHelper {
         OMNamespace ns = node.getNamespace();
         if (ns == null) {
             if (prefix.length() > 0) {
-                String msg = DOMMessageFormatter.formatMessage(
-                        DOMMessageFormatter.DOM_DOMAIN,
-                        DOMException.NAMESPACE_ERR,
-                        null);
-                throw new DOMException(DOMException.NAMESPACE_ERR, msg);
+                throw DOMUtil.newDOMException(DOMException.NAMESPACE_ERR);
             } else {
                 // No need to set a new OMNamespace in this case
             }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
Wed Sep  5 09:25:55 2012
@@ -120,9 +120,7 @@ public abstract class NodeImpl implement
     }
 
     public void setPrefix(String prefix) throws DOMException {
-        throw new DOMException(DOMException.NAMESPACE_ERR, DOMMessageFormatter
-                .formatMessage(DOMMessageFormatter.DOM_DOMAIN, DOMException.NAMESPACE_ERR,
-                               null));
+        throw DOMUtil.newDOMException(DOMException.NAMESPACE_ERR);
     }
 
     /**
@@ -214,8 +212,7 @@ public abstract class NodeImpl implement
         // This is not yet implemented. In the meantime, we throw a DOMException
         // and not an UnsupportedOperationException, since this works better with
         // some other libraries (such as Saxon 8.9).
-        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, DOMMessageFormatter
-                .formatMessage(DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_SUPPORTED_ERR,
null));
+        throw DOMUtil.newDOMException(DOMException.NOT_SUPPORTED_ERR);
     }
 
     public String getTextContent() throws DOMException {
@@ -587,10 +584,7 @@ public abstract class NodeImpl implement
         if (ownerDocument() != (otherNode instanceof AttrImpl
                 ? ((AttrImpl)otherNode).getOwnerDocument()
                 : ((NodeImpl)otherNode).ownerDocument())) {
-            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
-                                   DOMMessageFormatter.formatMessage(
-                                           DOMMessageFormatter.DOM_DOMAIN,
-                                           DOMException.WRONG_DOCUMENT_ERR, null));
+            throw DOMUtil.newDOMException(DOMException.WRONG_DOCUMENT_ERR);
         }
     }
     

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
Wed Sep  5 09:25:55 2012
@@ -217,10 +217,7 @@ public abstract class ParentNode extends
         }
 
         if (isAncestorOrSelf(newChild)) {
-            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
-                                   DOMMessageFormatter.formatMessage(
-                                           DOMMessageFormatter.DOM_DOMAIN,
-                                           DOMException.HIERARCHY_REQUEST_ERR, null));
+            throw DOMUtil.newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
         }
 
         if (newDomChild.parentNode() != null) {
@@ -232,10 +229,7 @@ public abstract class ParentNode extends
             if (newDomChild instanceof ElementImpl) {
                 if (((DocumentImpl) this).getOMDocumentElement(false) != null) {
                     // Throw exception since there cannot be two document elements
-                    throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
-                                           DOMMessageFormatter.formatMessage(
-                                                   DOMMessageFormatter.DOM_DOMAIN,
-                                                   DOMException.HIERARCHY_REQUEST_ERR, null));
+                    throw DOMUtil.newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
                 }
                 if (newDomChild.parentNode() == null) {
                     newDomChild.setParent(this, useDomSemantics);
@@ -244,10 +238,7 @@ public abstract class ParentNode extends
                     || newDomChild instanceof ProcessingInstructionImpl
                     || newDomChild instanceof DocumentFragmentImpl
                     || newDomChild instanceof DocumentTypeImpl)) {
-                throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
-                        DOMMessageFormatter.formatMessage(
-                                DOMMessageFormatter.DOM_DOMAIN,
-                                DOMException.HIERARCHY_REQUEST_ERR, null));
+                throw DOMUtil.newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
             }
         }
         
@@ -350,10 +341,7 @@ public abstract class ParentNode extends
             }
 
             if (!found) {
-                throw new DOMException(DOMException.NOT_FOUND_ERR,
-                                       DOMMessageFormatter.formatMessage(
-                                               DOMMessageFormatter.DOM_DOMAIN,
-                                               DOMException.NOT_FOUND_ERR, null));
+                throw DOMUtil.newDOMException(DOMException.NOT_FOUND_ERR);
             }
 
             if (newDomChild.parentNode() == null) {
@@ -379,10 +367,7 @@ public abstract class ParentNode extends
         }
 
         if (isAncestorOrSelf(newChild)) {
-            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
-                                   DOMMessageFormatter.formatMessage(
-                                           DOMMessageFormatter.DOM_DOMAIN,
-                                           DOMException.HIERARCHY_REQUEST_ERR, null));
+            throw DOMUtil.newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
         }
 
         checkSameOwnerDocument(newDomChild);
@@ -457,10 +442,7 @@ public abstract class ParentNode extends
         }
 
         if (!found)
-            throw new DOMException(DOMException.NOT_FOUND_ERR,
-                                   DOMMessageFormatter.formatMessage(
-                                           DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR,
-                                           null));
+            throw DOMUtil.newDOMException(DOMException.NOT_FOUND_ERR);
 
         return oldChild;
     }
@@ -471,10 +453,7 @@ public abstract class ParentNode extends
             ((NodeImpl)oldChild).detach(true);
             return oldChild;
         } else {
-            throw new DOMException(DOMException.NOT_FOUND_ERR,
-                                   DOMMessageFormatter.formatMessage(
-                                           DOMMessageFormatter.DOM_DOMAIN, DOMException.NOT_FOUND_ERR,
-                                           null));
+            throw DOMUtil.newDOMException(DOMException.NOT_FOUND_ERR);
         }
     }
 

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java?rev=1381097&r1=1381096&r2=1381097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
Wed Sep  5 09:25:55 2012
@@ -190,10 +190,7 @@ public abstract class TextNodeImpl exten
      */
     public Text splitText(int offset) throws DOMException {
         if (offset < 0 || offset > this.textValue.length()) {
-            throw new DOMException(DOMException.INDEX_SIZE_ERR,
-                    DOMMessageFormatter.formatMessage(
-                            DOMMessageFormatter.DOM_DOMAIN, DOMException.INDEX_SIZE_ERR,
-                            null));
+            throw DOMUtil.newDOMException(DOMException.INDEX_SIZE_ERR);
         }
         String newValue = this.textValue.substring(offset);
         this.deleteData(offset, this.textValue.length());



Mime
View raw message