Author: veithen
Date: Sun Jul 6 20:54:51 2014
New Revision: 1608291
URL: http://svn.apache.org/r1608291
Log:
OMSourcedElement: handle forceExpand at a somewhat lower level.
Modified:
webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
Modified:
webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj?rev=1608291&r1=1608290&r2=1608291&view=diff
==============================================================================
---
webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
(original)
+++
webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
Sun Jul 6 20:54:51 2014
@@ -171,6 +171,8 @@ public aspect OMContainerSupport {
}
public void IContainer.removeChildren() {
+ // We need to call this first because if may modify the state (applies
to OMSourcedElements)
+ CoreChildNode child = coreGetFirstChildIfAvailable();
boolean updateState;
if (getState() == CoreParentNode.INCOMPLETE && getBuilder() != null) {
OMNode lastKnownChild = getLastKnownOMChild();
@@ -182,7 +184,6 @@ public aspect OMContainerSupport {
} else {
updateState = false;
}
- CoreChildNode child = coreGetFirstChildIfAvailable();
while (child != null) {
CoreChildNode nextSibling =
(CoreChildNode)child.getNextOMSiblingIfAvailable();
((INode)child).setPreviousOMSibling(null);
Modified:
webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java?rev=1608291&r1=1608290&r2=1608291&view=diff
==============================================================================
---
webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
(original)
+++
webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
Sun Jul 6 20:54:51 2014
@@ -343,7 +343,6 @@ public class OMSourcedElementImpl extend
}
public Iterator getChildElements() {
- forceExpand();
return super.getChildElements();
}
@@ -445,17 +444,14 @@ public class OMSourcedElementImpl extend
}
public void setFirstChild(OMNode node) {
- forceExpand();
super.setFirstChild(node);
}
public void setLastChild(OMNode omNode) {
- forceExpand();
super.setLastChild(omNode);
}
public OMElement getFirstElement() {
- forceExpand();
return super.getFirstElement();
}
@@ -493,17 +489,14 @@ public class OMSourcedElementImpl extend
}
public void setText(String text) {
- forceExpand();
super.setText(text);
}
public void setText(QName text) {
- forceExpand();
super.setText(text);
}
public String getText() {
- forceExpand();
return super.getText();
}
@@ -512,7 +505,6 @@ public class OMSourcedElementImpl extend
}
public QName getTextAsQName() {
- forceExpand();
return super.getTextAsQName();
}
@@ -832,12 +824,10 @@ public class OMSourcedElementImpl extend
}
public void addChild(OMNode omNode) {
- forceExpand();
super.addChild(omNode);
}
public void addChild(OMNode omNode, boolean fromBuilder) {
- forceExpand();
super.addChild(omNode, fromBuilder);
}
@@ -846,37 +836,30 @@ public class OMSourcedElementImpl extend
}
public Iterator getChildrenWithName(QName elementQName) {
- forceExpand();
return super.getChildrenWithName(elementQName);
}
public Iterator getChildrenWithLocalName(String localName) {
- forceExpand();
return super.getChildrenWithLocalName(localName);
}
public Iterator getChildrenWithNamespaceURI(String uri) {
- forceExpand();
return super.getChildrenWithNamespaceURI(uri);
}
public OMElement getFirstChildWithName(QName elementQName) throws
OMException {
- forceExpand();
return super.getFirstChildWithName(elementQName);
}
public Iterator getChildren() {
- forceExpand();
return super.getChildren();
}
public Iterator getDescendants(boolean includeSelf) {
- forceExpand();
return super.getDescendants(includeSelf);
}
public OMNode getFirstOMChild() {
- forceExpand();
return super.getFirstOMChild();
}
@@ -1111,12 +1094,6 @@ public class OMSourcedElementImpl extend
}
public void removeChildren() {
- // One might think that if the element is not expanded, we don't need
to expand it because
- // we are going to remove the children anyway. However, this is not
true for two reasons:
- // * The element may have attributes and they must be available after
removeChildren().
- // * The local name, namespace URI and/or prefix of the element may
be unknown. In that
- // case, we need to expand the element to make this information
available.
- forceExpand();
super.removeChildren();
}
@@ -1141,6 +1118,7 @@ public class OMSourcedElementImpl extend
}
public CoreChildNode coreGetFirstChildIfAvailable() {
+ forceExpand();
return super.coreGetFirstChildIfAvailable();
}