Author: veithen
Date: Sat Mar 31 22:25:53 2012
New Revision: 1307924
URL: http://svn.apache.org/viewvc?rev=1307924&view=rev
Log:
Removed the readonly stuff in DOOM. Reasons:
* There is no code that ever sets the readonly flag to true.
* A DOM node is read-only if it is a descendant of an expanded entity
reference. However, this will never be implemented in DOOM because the StAX
event model is not rich enough to do that.
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/CharacterImpl.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/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/ProcessingInstructionImpl.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=1307924&r1=1307923&r2=1307924&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
Sat Mar 31 22:25:53 2012
@@ -272,13 +272,6 @@ public class AttrImpl extends NodeImpl i
* @see org.apache.axiom.om.OMAttribute#setAttributeValue(String)
*/
public void setAttributeValue(String value) {
- if (isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- msg);
- }
this.attrValue = (TextImpl) this.getOwnerDocument().createTextNode(
value);
}
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=1307924&r1=1307923&r2=1307924&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
Sat Mar 31 22:25:53 2012
@@ -51,14 +51,6 @@ public abstract class CharacterImpl exte
///
public void appendData(String value) throws DOMException {
-
- if (this.isReadonly()) {
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
-
DOMException.NO_MODIFICATION_ALLOWED_ERR, null));
- }
-
this.textValue += value;
}
@@ -73,13 +65,6 @@ public abstract class CharacterImpl exte
public void replaceData(int offset, int count, String data) throws
DOMException {
- if (this.isReadonly()) {
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
-
DOMException.NO_MODIFICATION_ALLOWED_ERR, null));
- }
-
int length = this.textValue.length();
if (offset < 0 || offset > length - 1 || count < 0) {
throw new DOMException(DOMException.INDEX_SIZE_ERR,
@@ -109,13 +94,6 @@ public abstract class CharacterImpl exte
public void insertData(int offset, String data) throws DOMException {
int length = this.getLength();
- if (this.isReadonly()) {
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
-
DOMException.NO_MODIFICATION_ALLOWED_ERR, null));
- }
-
if (offset < 0 || offset > length - 1) {
throw new DOMException(DOMException.INDEX_SIZE_ERR,
DOMMessageFormatter.formatMessage(
@@ -128,14 +106,7 @@ public abstract class CharacterImpl exte
/** Sets the text value of data. */
public void setData(String data) throws DOMException {
- if (!this.isReadonly()) {
- this.textValue = data;
- } else {
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
-
DOMException.NO_MODIFICATION_ALLOWED_ERR, null));
- }
+ this.textValue = data;
}
/**
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=1307924&r1=1307923&r2=1307924&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
Sat Mar 31 22:25:53 2012
@@ -281,14 +281,6 @@ public class ElementImpl extends ParentN
* @see org.w3c.dom.Element#removeAttribute(String)
*/
public void removeAttribute(String name) throws DOMException {
- if (this.isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- msg);
- }
-
if (name.startsWith(OMConstants.XMLNS_NS_PREFIX)) {
String namespacePrefix = DOMUtil.getLocalName(name);
if (this.findNamespaceURI(namespacePrefix) != null) {
@@ -309,14 +301,6 @@ public class ElementImpl extends ParentN
*/
public void removeAttributeNS(String namespaceURI, String localName)
throws DOMException {
- if (this.isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- msg);
- }
-
if (OMConstants.XMLNS_NS_URI.equals(namespaceURI)) {
//look in the ns list
if (this.namespaces != null) {
@@ -334,13 +318,6 @@ public class ElementImpl extends ParentN
* @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr)
*/
public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
- if (isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- msg);
- }
if (this.attributes == null
|| this.attributes.getNamedItem(oldAttr.getName()) == null) {
String msg = DOMMessageFormatter.formatMessage(
@@ -447,14 +424,6 @@ public class ElementImpl extends ParentN
}
}
- if (this.isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- msg);
- }
-
// check whether the attr is in use
if (attrImpl.isUsed()) {
String msg = DOMMessageFormatter
@@ -534,14 +503,6 @@ public class ElementImpl extends ParentN
}
}
- if (this.isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(
- DOMException.NO_MODIFICATION_ALLOWED_ERR, msg);
- }
-
// check whether the attr is in use
if (attrImpl.isUsed()) {
String msg = DOMMessageFormatter.formatMessage(
@@ -606,14 +567,6 @@ public class ElementImpl extends ParentN
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
}
- if (this.isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- msg);
- }
-
if (this.attributes == null) {
this.attributes = new AttributeMap(this);
}
@@ -1067,14 +1020,6 @@ public class ElementImpl extends ParentN
* @see org.apache.axiom.om.OMElement#setText(String)
*/
public void setText(String text) {
- if (this.isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- msg);
- }
-
// if we already have other text nodes remove them
OMNode child = this.getFirstOMChild();
while (child != null) {
@@ -1323,13 +1268,6 @@ public class ElementImpl extends ParentN
*/
public void setIdAttribute(String name, boolean isId) throws DOMException {
- if (this.isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- msg);
- }
//find the attr
AttrImpl tempAttr = (AttrImpl) this.getAttributeNode(name);
if (tempAttr == null) {
@@ -1345,13 +1283,6 @@ public class ElementImpl extends ParentN
public void setIdAttributeNS(String namespaceURI, String localName,
boolean isId)
throws DOMException {
- if (this.isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- msg);
- }
//find the attr
AttrImpl tempAttr = (AttrImpl) this.getAttributeNodeNS(namespaceURI,
localName);
if (tempAttr == null) {
@@ -1366,13 +1297,6 @@ public class ElementImpl extends ParentN
}
public void setIdAttributeNode(Attr idAttr, boolean isId) throws
DOMException {
- if (this.isReadonly()) {
- String msg = DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null);
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- msg);
- }
//find the attr
Iterator attrIter = this.getAllAttributes();
AttrImpl tempAttr = null;
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=1307924&r1=1307923&r2=1307924&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
Sat Mar 31 22:25:53 2012
@@ -57,8 +57,6 @@ public abstract class NodeImpl implement
protected final static short FIRSTCHILD = 0x1 << 2;
- protected final static short READONLY = 0x1 << 3;
-
protected final static short SPECIFIED = 0x1 << 4;
//
@@ -175,8 +173,6 @@ public abstract class NodeImpl implement
throw new RuntimeException("**Internal Error**" + e);
}
- newnode.isReadonly(false);
-
return newnode;
}
@@ -290,14 +286,6 @@ public abstract class NodeImpl implement
flags = (short) (value ? flags | FIRSTCHILD : flags & ~FIRSTCHILD);
}
- final boolean isReadonly() {
- return (flags & READONLY) != 0;
- }
-
- final void isReadonly(boolean value) {
- flags = (short) (value ? flags | READONLY : flags & ~READONLY);
- }
-
final boolean isSpecified() {
return (flags & SPECIFIED) != 0;
}
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=1307924&r1=1307923&r2=1307924&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
Sat Mar 31 22:25:53 2012
@@ -232,13 +232,6 @@ public abstract class ParentNode extends
DOMException.WRONG_DOCUMENT_ERR,
null));
}
- if (this.isReadonly()) {
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
-
DOMException.NO_MODIFICATION_ALLOWED_ERR, null));
- }
-
if (this instanceof Document) {
if (newDomChild instanceof ElementImpl) {
if (((DocumentImpl) this).getOMDocumentElement(false) != null)
{
@@ -405,13 +398,6 @@ public abstract class ParentNode extends
DOMException.WRONG_DOCUMENT_ERR,
null));
}
- if (this.isReadonly()) {
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
-
DOMException.NO_MODIFICATION_ALLOWED_ERR, null));
- }
-
Iterator children = this.getChildren();
boolean found = false;
while (!found && children.hasNext()) {
@@ -484,14 +470,6 @@ public abstract class ParentNode extends
/** Removes the given child from the DOM Tree. */
public Node removeChild(Node oldChild) throws DOMException {
- // Check if this node is readonly
- if (this.isReadonly()) {
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
-
DOMException.NO_MODIFICATION_ALLOWED_ERR, null));
- }
-
if (oldChild.getParentNode() == this) {
((ChildNode)oldChild).detach();
return oldChild;
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java?rev=1307924&r1=1307923&r2=1307924&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java
Sat Mar 31 22:25:53 2012
@@ -79,14 +79,7 @@ public class ProcessingInstructionImpl e
}
public void setData(String data) throws DOMException {
- if (!isReadonly()) {
- value = data;
- } else {
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
-
DOMException.NO_MODIFICATION_ALLOWED_ERR, null));
- }
+ value = data;
}
public String getNodeName() {
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=1307924&r1=1307923&r2=1307924&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
Sat Mar 31 22:25:53 2012
@@ -240,12 +240,6 @@ public abstract class TextNodeImpl exten
* node has no data.
*/
public Text splitText(int offset) throws DOMException {
- if (this.isReadonly()) {
- throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- DOMException.NO_MODIFICATION_ALLOWED_ERR, null));
- }
if (offset < 0 || offset > this.textValue.length()) {
throw new DOMException(DOMException.INDEX_SIZE_ERR,
DOMMessageFormatter.formatMessage(