You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2011/05/14 19:22:56 UTC
svn commit: r1103165 -
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/ParentNode.java
Author: mrglavas
Date: Sat May 14 17:22:55 2011
New Revision: 1103165
URL: http://svn.apache.org/viewvc?rev=1103165&view=rev
Log:
Fixing JIRA Issue #1421: http://issues.apache.org/jira/browse/XERCESJ-1421. We were calling previousSibling() when the node was in an inconsistent state, which would return the last child instead of null when the first child is being removed. We were just lucky to get the correct result from checkNormalizationAfterRemove(). Now it works by design and should be slightly faster when we're removing the first child. Patch thanks to Ludger Bünger. Also thanks to Thiwanka Somasiri for helping to investigate this issue and evaluating Ludger's patch.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/ParentNode.java
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/ParentNode.java?rev=1103165&r1=1103164&r2=1103165&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/ParentNode.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/ParentNode.java Sat May 14 17:22:55 2011
@@ -502,6 +502,9 @@ public abstract class ParentNode
// notify document
ownerDocument.removingNode(this, oldInternal, replace);
+
+ // Save previous sibling for normalization checking.
+ final ChildNode oldPreviousSibling = oldInternal.previousSibling();
// update cached length if we have any
if (fNodeListCache != null) {
@@ -513,7 +516,7 @@ public abstract class ParentNode
// move the cache to its (soon former) previous sibling
if (fNodeListCache.fChild == oldInternal) {
fNodeListCache.fChildIndex--;
- fNodeListCache.fChild = oldInternal.previousSibling();
+ fNodeListCache.fChild = oldPreviousSibling;
} else {
// otherwise just invalidate the cache
fNodeListCache.fChildIndex = -1;
@@ -544,9 +547,6 @@ public abstract class ParentNode
}
}
- // Save previous sibling for normalization checking.
- ChildNode oldPreviousSibling = oldInternal.previousSibling();
-
// Remove oldInternal's references to tree
oldInternal.ownerNode = ownerDocument;
oldInternal.isOwned(false);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org